-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
Cannot dump no values with comments #196
Comments
I don't understand what do you want to achieve. JS-YAML dumps given data exactly as is. |
If now I try to dump the object it will write to the file: common: I want common: So with another words, js-yaml always put value in quotes if you have any special character. So if you want to have a comment, you can't use any special characters including spaces, etc. Kinda limitation |
You want to add comments to the dump? |
yes, now I'm missing this functionality in this library. I want to create a configuration file where some fields don't have any values and provide a comment for the user to fill it in. But instead I have quoted value :( |
I think JS-YAML is not suitable for such tasks by design. It targets to fast data (de)serialization and therefore misses fine configuration. I mean that in order to generate a dump that looks like it was written by a human, you will need AST access, which JS-YAML cannot provide. It is possible to add option that will accept object of the same structure as data to dump and write it's values as comments, but I don't think that it will have much sense, and I don't think I like the idea of adding such weird stuff to the library. @puzrin What do you think about this? |
That's out of this library scope. |
Can we reevaluate the need of supporting comments?! It would be great, because by doing that it can be used in Prettier to start supporting and formatting YAML files with it: prettier/prettier#3017 |
No, because that requires completely different architecture, and this one is focused on speed. |
I have no idea how it's done.. but I'm sure there is a way to fix it without compromising speed.. it's 2017 :) |
Development is clear technical process, not religion. We can operate only materializable things, beliefs are not enougth to take into account :) |
thanks for the info.. I wasn't aware.. :P |
It is not possible currently to achieve such result:
common:
apiKey: # This is a required field
The text was updated successfully, but these errors were encountered: