Skip to content

Allow YAML files #19

@dmyersturnbull

Description

@dmyersturnbull

Problem

Long .properties files are hard to read. This is noticeable even in seqmotif, where key nesting is not obvious.

Priority: minor.

Solution

YAML 1.2 is a good option. (1.1 is actually, really, truly horrific.)

yaml.org lists snakeyaml-engine as its recommended YAML 1.2 parser for Java. That project is maintained.

Changes

The changes are very easy to implement.

  1. Let ConfigManager.read delegate to ConfigManager.readYaml or ConfigManager.readProperties per the filename suffix.
  2. Split keys on . to define superkey–subkey relationships (left-associative).

Both changes are technically breaking but very unlikely to cause real-world problems.

  1. .properties files should use that suffix anyway.
  2. In some projects, . is used to join words. Listing job.to.run = x defines job and job.to. Although that leads to semantically invalid keys, there will be no effect unless job or job.to is also defined. Prefer - to join words instead.

Alternatives

TOML is great, but Java parsers for it are poorly maintained, and there's little reason to support both YAML and TOML.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions