-
-
Notifications
You must be signed in to change notification settings - Fork 774
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
Option to omit space between array elements #346
Comments
IMHO that's a madness to use yaml parser/dumper such way :). It's not intended for URL encoding. Goal of dumper is to create pretty human-readable result. May be it creates something close to your wishes... by accident... but that's not enougth to add as official option. I tend to reject as "out of project scope", but if i miss something important, please explain. |
Well, what is the project scope? According to the readme:
Good applications should have readable, human friendly URLs, at the same time complicated applications have complicated data to serialize in the URL. A clear use case for a human-friendly data serialization language. Basic JSON can encode nested data, but results in bloated output and lots of reserved characters because of the required quotes everywhere. YAML sits perfectly in-between, supporting all data structures of JSON with the simplicity of basic, unquoted It fits directly into the project scope imo. It doesn't create something close to what I want by accident, it creates something close to what I want because what I want (a human friendly yet powerful data serialisation) is exactly what this project offers (a human friendly yet powerful data serialisation) 🙂 I understand that you don't want to commit to maintaining a lot of code for rare use cases, but I imagine the implementation and maintenance cost of this to be minimal. There are already great options to control the line breaking behaviour, I don't think an option to omit the added space in this single case (array elements) would hurt. |
Ok, PR with condensed flow mode support will be accepted. |
Closing to keep tracker clear. But if anyone decide to create PR - that will be accepted. |
We like to encode objects and arrays to query parameters using YAML. The parser is able to parse this correctly:
But unfortunately, the dumper always adds unneeded spaces between array elements:
We don't encode
[]
for prettiness and browsers can handle them fine (PHP has used them forever), but spaces of course do need to be encoded, which is not very pretty.Here are the options I am currently using to output single line YAML:
It would be great to have an option for omitting these non-required spaces / emitting "minimized" YAML.
The text was updated successfully, but these errors were encountered: