Empty strings are silently replaced with 'null' now
Nobody has claimed this yet.
- #1460 by @mvanhorn — closed without merging
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
Start by reading the yaml-cpp 0.8.0 parsing and scalar conversion behavior for empty YAML values; the issue does not name source files or tests. Reproduce the message: example and compare Scalar() and as<std::string>() for an empty value and an explicit null. Done means the empty value yields an empty string while explicit null remains distinguishable; the issue has a prior unmerged pull request, so check its discussion for context.
Written by the indexing model from the issue text.
Description
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:
node["message"].as<std::string>() //=> "null"
I know that such a value can be interpreted as null, hence IsNull() -> 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="" vs message="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 want Scalar() == as<std::string>() == "null"
- Dominant language
- C++
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 22h 2m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jbeder/yaml-cpp
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
-
Difficulty 3/5 Half a day Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
Similar issues
-
artifact:simulation-scenario domain:physics good first issue help wanted role:validation testing
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 3 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
moneymanagerex/moneymanagerex#8600 · 1 comment ·
Maintainers usually reply within 4 days
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
NVIDIA/accelerated-computing-hub#294 ·
Maintainers usually reply within 4 days