yaml / yaml-spec

YAML Specification
http://yaml.org/spec/
348 stars 54 forks source link

Would like to specify that a list of lists should be flattened #339

Open acampove opened 1 month ago

acampove commented 1 month ago

Hi,

I have a file like:

mammals: &mammals
  - lion
  - tiger
  - elephant

reptiles: &reptiles
  - snake
  - lizard
  - crocodile

animals:
  - *mammals
  - *reptiles

In the example above, animals is not a single list, but two and we would have to flatten this in the code. It would be good if we could somehow specify that these lists have to be flattened, e.g. with - **mammals.

UnePierre commented 1 month ago

Another syntax could follow that for appending maps, like:

mammals: &mammals
  - lion
  - tiger
  - elephant

reptiles: &reptiles
  - snake
  - lizard
  - crocodile

animals:
  <<:
    - *mammals
    - *reptiles