tanbro / pyyaml-include

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

Added feature persist anchors to included yaml files #32

Closed NoahFeinberg closed 1 year ago

NoahFeinberg commented 1 year ago

Hi tanbro, I thought it would be nice if this library also supported anchors when including a yaml file so I wrote this PR. I based code for this update on this stack over flow thread https://stackoverflow.com/questions/44910886/pyyaml-include-file-and-yaml-aliases-anchors-references

Below is an example for how the new feature works:

group.yml

group
  user:
    name: noah
    team: *team 
  user:
    name: aron
    team *team

devops.yml

team: &team devops
devops: !include group.yml

output.yml

devops:
  group
    user:
      name: noah
      team: devops 
    user:
      name: aron
      team: devops
sonarcloud[bot] commented 1 year ago

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

tanbro commented 1 year ago

@NoahFeinberg Great job!

Will you commit some testcases for anchors?

NoahFeinberg commented 1 year ago

sure thing I will work on a PR with some updates

NoahFeinberg commented 1 year ago

Sorry haven't found time to write test cases will come back to this when I find some free time