tanbro / pyyaml-include

yaml include other yaml
https://pypi.org/project/pyyaml-include/
GNU General Public License v3.0
77 stars 20 forks source link

New Feature: Support Flattening Sequence Objects When Including Multiple Files #47

Closed tanbro closed 1 week ago

tanbro commented 1 week ago

Added the flatten parameter, which allows flattening sequence objects when including multiple YAML files. This is applicable when top-level sequence objects are included in each matching YAML file, avoiding the creation of a two-dimensional array and instead providing a flattened sequence.

By setting flatten=true, users can merge sequence objects from multiple included files into a single sequence rather than having a sequence of sequences. If the flatten parameter is not set or is set to false (the default behavior), the sequences will remain nested as they were originally.

This feature is only available when multiple matching files are included, and each matching file must contain a sequence object at the top level; otherwise, it may trigger a TypeError exception.