-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Empty strings are silently replaced with 'null' now #1290
Comments
This might be okay if the new behavior is more consistent. |
You can check the type of the node. Is that sufficient? |
Not really, because earlier I force-interpreted the node as a string. I guess that's not possible in the recent versions of the library. The way forward for me will be to go through my configs, replacing |
Reopening because of inconsistency. According to #590, it seems that a user may want to get the value of a Scalar (in the meaning from the spec), ignoring nulls, and that the library supports it. But what happens in practice is, if the Scalar is a null, then yaml-cpp replaces its value (which can be What should happen is, the original text representation of the null value should be kept in the |
Yeah that's reasonable. |
I've been upgrading from an older yaml-cpp version to 0.8.0.
What I found different is that for empty strings, behavior has changed, they are now replaced with
"null"
.For example, given the following YAML:
message:
I know that such a value can be interpreted as
null
, henceIsNull() -> true
is expected.However, my parsing for this particular option does not allow for nulls, I always interpret this as a string. In my case
message=""
vsmessage="null"
makes a difference, and I can't easily distinguish between them.Can yaml-cpp revert to the old behavior in this case?
For an empty value, I want
Scalar() == as<std::string>() == ""
For
null
value, I wantScalar() == as<std::string>() == "null"
The text was updated successfully, but these errors were encountered: