You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I' using version 12.0.0 and have the following YAML:
on:
implicit:
explicit: nullempty-string: ''
During deserialization, the implicit null value of workflow_dispatch gets interpreted as an empty string "":
Deserializer.Deserialize<YamlMappingNode>(reader)
on:
implicit: ''explicit: nullempty-string: ''
Same thing can be observed during serialization when I manually create a YamlScalarNode with a null value.
For the low level representation as Yaml{*}Node I would expect the original format to get preserved. If there was an explicit null it should re-serialize as explicit null and if there was an implicit null, it should re-serialize as implicit null. In no case should it re-serialize as "" imho.
When using Dictionary<object, object> instead of YamlMappingNode as the target type for the deserialization method, everything seems to work fine. Explicit null values are emitted as implicit ones at the end, but that's fine in this case I guess.
As for reserializing explicit null to implicit null, once the yaml document is converted to a dot net object we no longer have how it was represented in the yaml document. It's a dot net limitation, we can't safely add arbitrary properties to an object. Not that I am aware of anyways, so we can't re-serialize exactly to what it was, just what is considered valid yaml.
As for deserializing an implicit null to an empty string instead of null, you are correct, that is a bug that needs to be addressed. I'm adding the bug tag so we can look at it. If you want to take a stab at it and submit a PR then that would be great.
I put in a fix for something similar to this issue in the last release (might have been the one before). Can you confirm if this is still a problem or not? If it is can post a complete code example to reproduce it?
Hi, I' using version
12.0.0
and have the following YAML:During deserialization, the implicit
null
value ofworkflow_dispatch
gets interpreted as an empty string""
:Same thing can be observed during serialization when I manually create a
YamlScalarNode
with anull
value.For the low level representation as
Yaml{*}Node
I would expect the original format to get preserved. If there was an explicitnull
it should re-serialize as explicitnull
and if there was an implicitnull
, it should re-serialize as implicitnull
. In no case should it re-serialize as""
imho.When using
Dictionary<object, object>
instead ofYamlMappingNode
as the target type for the deserialization method, everything seems to work fine. Explicitnull
values are emitted as implicit ones at the end, but that's fine in this case I guess.The text was updated successfully, but these errors were encountered: