-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
YAML: consider starting #
and ending :
as quotable characters
#465
YAML: consider starting #
and ending :
as quotable characters
#465
Conversation
Signed-off-by: Michael Edgar <michael@xlate.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, will make some minor tweaks before merging but idea makes sense (change was subtle had to look carefully :) ).
@MikeEdgar one procedural thing before merging: if we don't yet have CLA (only needs to be sent once for all contributions, before merging the first), it's here: https://github.com/FasterXML/jackson/blob/master/contributor-agreement.pdf and it's usually easiest to print, fill & sign, scan/photo, email to Thank you very much for contributing this (esp. great to have test coverage); looking forward to merging it. |
I'm not quite sure if this is/was desired behavior, as the original description only states
|
@oliversaggau Thank you for double-checking :) |
@MikeEdgar , can you please explain/elaborate what was wrong with the single quotes before? And why do you think the double quotes are necessary for scalar values starting with # char? |
@ivangal2 it was inconsistent. Jackson would quote some values with |
one question, what if single quote(') is needed to keep consistency, is there a way to configure(select) the style of quoting(single or double), thanks! |
@Weinan-Zhang I am not 100% sure but I think there is no option for using single quote. If this is something you would like, feel free to file an issue requesting such feature (and if you have time and interest possibly even contribute a PR for adding). I don't know whether this would be easy to do -- considering complexity in configuring details of SnakeYAML output used by this module -- but it should be doable. |
Scalar values starting with
#
or ending with:
should be quoted. Currently, SnakeYAML will single-quote them automatically. This change will proactively trigger the double quote style used for other values that require quotes whenMINIMIZE_QUOTES
is enabled.