Read in YAML with merge then dump strips the merge information

Issue #450 invalid
Charlie Hayes created an issue

Steps to reproduce:

  1. Load YAML using a merge (<<)
  2. Dump the result

Expected result:

  • Dumped YAML contains the merge reference (<<)

Actual result

  • Dumped YAML inlines the merge values

Comments (7)

  1. Andrey Somov

    Dumped YAML should not contain the merge tag because the object which is serialized does not have any indication that it was merged.

    You have to implement your own Representor/Constructor to make it work.

  2. Charlie Hayes

    Sounds like you’re describing the ‘actual result’ and a work around.

    After seeing that merge is not in YAML 1.2 and likely removed in 1.3, I’ll probably avoid the thing altogether.

    Regardless, a caveat in the documentation saying it’s not fully supported with a reference to the removal from spec would be a satisfactory resolution.

  3. Charlie Hayes

    I personally wouldn’t consider it supported until it survived a roundtrip through deserialization and reserialization with default options (or easy option flags).

  4. Andrey Somov

    It is EXACTLY to avoid any personal consideration we have the spec.

    If you feel the roundtrip must be supported either find the reference in the spec or get the answer in the YAML mailing list or any other public place.

  5. Andrey Somov

    Do not mix against a spec and above (or outside of) a spec.

    Roundtrip is not part of the spec and that is why you cannot demand its implementation.

    A parser is free to implement any feature which is on top of the spec, but this particular feature is definitely out of scope, it does not belong to the general parser.

  6. Log in to comment