OpenHFT / Chronicle-Wire

A Low Garbage Java Serialisation Library that supports multiple formats
http://chronicle.software
Apache License 2.0
513 stars 123 forks source link

YAML list state (trailing commas) seeps into next parsed object #943

Open alamar opened 4 weeks ago

alamar commented 4 weeks ago

Suppose you have a YAML file with multiple consequitive objects going like

object1:
  - !Object1 {
    list: [
      'of',
      'items'
     ] # , may go after this
   } # , may go after this

!Object2 {
  ...
}

The problem is, if a comma goes after the closing square bracket (or curly bracket?), then Object2 is going to be a part of object1 list. If it is absent, in our code base Object2 will be read as next object, but in the test that I will provid it crashes as well.

alamar commented 4 weeks ago

Please note that this YAML might be sligtly ill-formed - in reality it needs a --- between objects, but this causes issues as well and will have a test case of its own