pyyaml-include icon indicating copy to clipboard operation
pyyaml-include copied to clipboard

Include without key or sequence

Open ceccocats opened this issue 5 months ago • 3 comments

Referring to #7

Having the files 0.yml:

foo0: bar0

1.yml:

foo1: bar1

Its possible to load multiple yaml with these methods:

  • using keys
    : !include include.d/0.yml
    : !include include.d/1.yml
    
    and obtain:
    0: {'foo0': 'bar0'}, 1: {'foo1': 'bar1'}}
    
  • using sequence
     !include include.d/0.yml
     !include include.d/1.yml
    
    and obtain
    {'foo0': 'bar0'}, {'foo1': 'bar1'}]
    

What i would like to obtain is:

{'foo0': 'bar0', 'foo1': 'bar1'}

I think that by using yaml Merge Key I should obtain what I want:

<<: !include include.d/0.yml
<<: !include include.d/1.yml

Unfortunately i get expected a mapping or list of mappings for merging, but found scalar error.

Its possible to support this include pattern?

Thanks, Francesco

ceccocats avatar Jul 14 '25 12:07 ceccocats