Conversation
A patch to allow yaml-cpp to compile with gcc and libcxx
Support for YAML Merge keys ( <<: [*dict1, *dict2] ) is added. The merge key is a specific scalar with value << (and tag !!merge) that implies that during node construction, the map (or sequence of maps) are merged into the current map. The priority rules are that each key from maps within the value associated with << are added iff the key is not yet present in the current map (and first map gets higher priority). Test cases have been added accordingly.
…the node) The problem is that const_map_to.get(*j->first) compares only the shared_ptr's, while we need to compare the key itself. v2: remove const iterator v3: fix use-after-free due to const reference
Consider the following YAML:
trait1: &t1
foo: 1
trait2: &t2
foo: 2
merged:
<<: *t1
<<: *t2
yq reports:
$ yq .merged.foo < /tmp/yaml
2
while the order that yaml-cpp returns is different, since it will
firstly handle 1, and will not replace it with 2:
$ util/parse < /tmp/yaml
trait1:
? &1 foo
: &2 1
trait2:
foo: 2
merged:
*1 : *2
(Don't mix up "*2" with "2", it is trait1)
* merge-operator: Fix order for merging iterator Fix merge operator support (that can be visible by iterating through the node) Fix merge-key handling in case the dictionary contains a sub-dictionary Adding support for handling YAML Merge Key (jbeder#41)
Update lib and apply PR for YAML Merge Key
Author
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is for ClickHouse/ClickHouse#75031
Which has been fixed in #1406