aaubry / YamlDotNet

YamlDotNet is a .NET library for YAML
MIT License
2.53k stars 470 forks source link

Tracking issue for YAML 1.2 emitter support #484

Open am11 opened 4 years ago

am11 commented 4 years ago

YDN v8.1.1+ support scanning and parsing of YAML 1.2 documents by the spec. This is indicated in the repo's README.

This issue is to track support for YAML 1.2 for emitter and (JSON) serializer.

As a prerequisite cleanup, I propose to refactor some bits for better diagnosability and facilitating emitter spec testing:

after that:

After the initial bootstrapping of emitter test runner, add the list of failing tests below this line for tracking.

TODO: add list

aaubry commented 4 years ago

This looks good. FYI, I'm currently working on implementing schemas, based on the 1.2 spec. This may be relevant for this work.

am11 commented 4 years ago

Cool, looking forward to it. 🙂 I haven't' looked much deeper but I think we have some spec tests validating schema on emitter side.

After the #485 refactoring, I will switch to working on emitter spec tests execution.

bootzin commented 3 years ago

How's the progress on this?

am11 commented 3 years ago

@bootzin, spec suite for emitters was configured in master branch, such that anyone can contribute to improve the coverage and de-ignore the related specs. https://github.com/aaubry/YamlDotNet/blob/e32f92ed079c1b62fdd949b37c23db047649934c/YamlDotNet.Test/Spec/SerializerSpecTests.cs#L39

My last work in progress for emitters was a scenario which we do not currently support (for 1.1 either): "end-to-end (roundtripable) mapping of anchors". We have added support for anchor deserialization in #490. However, for serialization, preserving anchor E2E becomes quite complicated and expensive in terms of performance (hint; reflection and bookkeeping of complex object graphs), code complexity and maintenance.. unless we add support for C# 9 code generators or some such.

Also, I am not sure how valuable is it in real world? One of the Ruby based YAML library used to have this kind of anchor serialization support, but they removed it (probably it was deemed not worth the effort?)