Skip to content
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

Adding support for handling YAML Merge Key (#41) - proper keys comparison for merging #1279

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Commits on Nov 4, 2023

  1. Adding support for handling YAML Merge Key (jbeder#41)

    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.
    nlescoua committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    6bbc603 View commit details
    Browse the repository at this point in the history

Commits on Dec 8, 2023

  1. Configuration menu
    Copy the full SHA
    6292971 View commit details
    Browse the repository at this point in the history

Commits on May 3, 2024

  1. Fix merge operator support (that can be visible by iterating through …

    …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
    azat committed May 3, 2024
    Configuration menu
    Copy the full SHA
    bcf7604 View commit details
    Browse the repository at this point in the history
  2. Fix order for merging iterator

    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)
    azat committed May 3, 2024
    Configuration menu
    Copy the full SHA
    2acec3d View commit details
    Browse the repository at this point in the history

Commits on Sep 23, 2024

  1. Mark MergeMapCollection() static

    azat committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    8945297 View commit details
    Browse the repository at this point in the history