Skip to content

YAMLConfiguration handles trailing comma not as expected #215

@pgeier

Description

@pgeier

What happened?

I've got a json file with the following structure

{"rules": [
  {...}, 
  {...},
   ..., 
  {...},
]}

The file is read with eckit::LocalConfiguration{eckit::YAMLConfiguration{eckit::PathName{...}}}
and accessed with .getSubConfigurations("rules"), which returns a std::vector<eckit::LocalConfiguration>.

Now, because of the trailing comma, the vector contains an additional element which is printed as LocalConfiguration[root=].
This element is not expected.

For a formal JSON, the trailing comma would not be allowed. In a YAML file it should (AFAIK - maybe compare with this closed issue on the YAML formatter prettier: prettier/prettier#7452)

What are the steps to reproduce the bug?

Create an additional test that parses a list with trailing comma.

Version

1.30.0

Platform (OS and architecture)

Atos

Relevant log output

There are just followup errors when accessing keys in the subdictionary.
Explicitly printing the last entry shows `LocalConfiguration[root=]`.

Accompanying data

No response

Organisation

ECMWF

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions