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

comments aren't preserved in generated files #19

Open
esilva-everbridge opened this issue Dec 13, 2019 · 0 comments
Open

comments aren't preserved in generated files #19

esilva-everbridge opened this issue Dec 13, 2019 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@esilva-everbridge
Copy link
Contributor

esilva-everbridge commented Dec 13, 2019

Files output by the tool do not maintain YAML comments.

One consequence is that trying to mask jinja code using comments will result in the jinja being stripped from the resulting file. As the tool will not parse files with naked jinja using comments would be the only good way to preserve it.

something like this should be allowed:

foo:
# {%- if grains['envtype'] == 'dev' %}
    bar: |
        foo
# {%- else %}
        bar
# {%- endif %}

Currently this would be stripped down to something like:

foo:
    bar: |
        foo
        bar

The go-yaml.v3 module can support comments, but it isn't clear how. There is also the Mozilla yaml fork that has an alternative approach which might be useful:

https://github.com/go-yaml/yaml/blob/v3/yaml.go
https://github.com/mozilla-services/yaml/blob/v2/yaml.go

@esilva-everbridge esilva-everbridge added the bug Something isn't working label Dec 13, 2019
@esilva-everbridge esilva-everbridge self-assigned this Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant