-
Notifications
You must be signed in to change notification settings - Fork 458
Feature request: Native comments-preserving conversion from YAML -> JSONNET #698
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
Know of a YAML parser that preserves whitespace and comments?
YAML is a very complex format so writing a parser is hard.
…On Tue, 13 Aug 2019 at 18:40, Joshua Dotson ***@***.***> wrote:
In the evolution of piles of YAML to JSONNET, we find ourselves converting
YAML -> JSON -> JSONNET a *lot*. When we do this, YAML comments are
dropped in the lossy conversion from YAML -> JSON. However, if the
conversion were from YAML -> JSONNET that conversion needn't and shouldn't
be lossy with respect to comments.
Thoughts?
Thanks!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#698?email_source=notifications&email_token=AABJBXRJ5P2X55WSGYKHTKTQEMZ5NA5CNFSM4ILPMKC2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFCLCTA>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABJBXRB5YXRHVG5QVFVWI3QEMZ5NANCNFSM4ILPMKCQ>
.
|
This could be pretty useful. I think it should be a completely separate tool, unless there is a some reason for tighter integration. The only parser that doesn't drop comments that I could find is ruamel.yaml. However comment extraction seems to be far from trivial: https://stackoverflow.com/questions/55130078/yaml-parsing-with-comments-for-doc-purpose |
Thanks for the replies. I looked at ruamel.yaml and https://github.com/mohsen1/yawn-yaml as well, neither of which would easily integrate with either of jsonnet's two implementations. A freestanding tool would be fine with me. Feel free to close this since standalone is the only practical way forward at this time. |
Maybe it's possible to use that to make a YAML -> JSON+comments converter, which can then be input into |
This is tracked by #765. |
* Add support for bzlmod
In the evolution of piles of YAML to JSONNET, we find ourselves converting YAML -> JSON -> JSONNET a lot. When we do this, YAML comments are dropped in the lossy conversion from YAML -> JSON. However, if the conversion were from YAML -> JSONNET that conversion needn't and shouldn't be lossy with respect to comments.
Thoughts?
Thanks!
The text was updated successfully, but these errors were encountered: