-
-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YamlStream loses tag information #409
Comments
The workaround in (https://dotnetfiddle.net/6Wz73c) seems to work, but with some tweaking. In YamlDotNetCore the save method overload that accepts the emitter is not there, so I needed to use reflection as a workaround. var emitter = new MappingFix(new Emitter(writer));
emitter.Emit((ParsingEvent)new StreamStart());
foreach (YamlDocument doc in YamlStream.Documents)
{
// The save method is not public in this version, so we'll have to call it internally. fugly? yes..
var invoker =
typeof(YamlDocument).GetMethod("Save", BindingFlags.Instance | BindingFlags.NonPublic);
invoker.Invoke(doc, new object[]{emitter, false});
}
emitter.Emit((ParsingEvent)new StreamEnd()); |
I recommend that you update to the latest release of YamlDotNet instead. The YamlDotNet.NetCore package is maintained by someone else and there haven't been any updates to it since 2016. |
Ah.. you're right.. that works much better.. Thanks :) |
Tested this example against multiple implementations and it turned out that:
So YDN's parser and scanner are pretty close to standard conformance for YAML 1.2 spec (5.11% spec tests pending conformance). For the emitter, YamlStream/Serializer, would it make sense to make their default behavior conform with the output that official spec suite expect as well? I tested it to certain extent and out of 199 spec tests (that has |
The manager lists "Antoine Aubry" as author for both packages - shouldn't it be the same maintainer? |
If you check on nugget.org you'll see that the package is published by someone else. I already contacted that person in the past and they said that they would unpublish the package. However they didn't. Feel free to contact them, maybe you will have more luck. |
the bug still persists. var address = new YamlDocument(
new YamlMappingNode(
new YamlScalarNode("street"), new YamlScalarNode("123 Tornado Alley\nSuite 16") { Style = YamlDotNet.Core.ScalarStyle.Literal },
new YamlScalarNode("city"), new YamlScalarNode("East Westville"),
new YamlScalarNode("state"), new YamlScalarNode("KS")
)
{ Tag = "Nomb"})
;
YamlStream st = new YamlStream(address);
using (TextWriter writer = File.CreateText("C:\\...\\some-file.yaml"))
{
st.Save(writer, false);
} with
the tag just gets eaten |
As reported here, YamlStream seems to be loosing tag information associated with mappings.
A preliminary investigation indicates that this is related to the
IsCanonical
property ofMappingStart
.The text was updated successfully, but these errors were encountered: