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 are stripped from output file #27

Open
jason-henriksen opened this issue Jun 17, 2020 · 3 comments
Open

comments are stripped from output file #27

jason-henriksen opened this issue Jun 17, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@jason-henriksen
Copy link

It would be much nicer if the comments in the included files were also able to appear in the output file.

Our output cloudformation file is both functional and documentation. But now people have to go dig up the sub-files in order to read the comments.

@justinnichols justinnichols added the enhancement New feature or request label Jun 17, 2020
@justinnichols
Copy link
Collaborator

Two things about this:

  1. Comments are designed to be in source files, not compiled files. Since yamlinc produces a compiled file (that just happens to be readable in YAML format), it makes sense to keep the comments in the source files. However, I can see the use case of allowing them to be merged with the YAML.
  2. js-yaml is the underlying library in use in this project which reads in the YAML into a JSON object structure, merges, then writes back out in a YAML structure. js-yaml, by nature of converting to in-memory JSON objects, cannot carry over comments. Therefore, this may require a different methodology of merging files to support this enhancement. In other words, it may be outside of the scope of this project.

I am not the maintainer of this codebase, just a contributor, so I will defer to @francescobianco on whether or not yamlinc should support this, or even can support this. In the meantime, I can at least look to see what options might be available. Also, if anything I have said above is incorrect (since I haven't looked at this project in some time), please feel free to correct my mistake.

@jason-henriksen
Copy link
Author

There are newer parsers that allow the comments to be maintained. It may be that the code would need a new parser or a new configuration in the existing parser.

Lacking the comments in the output file, especially for a template.yaml that's used in cloudformation is frustrating for people who just need to read the output. If nothing else, it removes the ability to put separators between sections.

@justinnichols
Copy link
Collaborator

Agreed, I definitely understand the use case. It looks like are a couple libraries that can possibly help with this:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants