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

Improve MINIMIZE_QUOTES handling to avoid quoting for some use of # and : #201

Merged
merged 1 commit into from
Jun 4, 2020

Conversation

frantuma
Copy link
Contributor

@frantuma frantuma commented Jun 3, 2020

#181 and 2 more #180 related commits introduce some improved YAML scalars quoting more compliant to the YAML Spec, in the MINIMIZE_QUOTES mode; the updated behavior seems to be at least more strict (in quoting) than necessary, as it introduces quoting for any value containing chars as # and :.

If I am not mistaken YAML Spec states that such plain style limitation is applied for cases where the character combinations # (<space_or_tab>+<#>) and : (<:>+<space_or_tab>) are present, not the single chars # and :.

This PR updates behavior by considering the character combinations and not the single chars.

This has been triggered by an update of Jackson from 2.10.4 to 2.11.0 which caused YAML serialization test failures due to the difference in quoting, e.g. in case of scalar representing URIs, JSON references, date or datetime.

I understand that this is probably not a major issue, and e.g. code or tests can be adjusted in dependent projects and downstream, but I believe the affected scenarios are quite common and it would make sense to keep quotes at a minimum when minimize is on.

Not sure if the target branch 2.11 is the correct one, was wondering if this could make it for 2.11.1 patch release in case.

@cowtowncoder
Copy link
Member

@frantuma Thank you! I think you nailed it; I like the idea of more targeted quoting, and I think risk/reward ratio works for 2.11.1 (early enough patch). Will merge.

@cowtowncoder cowtowncoder merged commit 21d1f67 into FasterXML:2.11 Jun 4, 2020
@cowtowncoder cowtowncoder modified the milestones: 2.10, 2.11.1 Jun 4, 2020
@cowtowncoder cowtowncoder changed the title REF #180 - updates YAML scalars with indicators quoting style Improve MINIMIZE_QUOTES handling to avoid quoting for some use of # and : Jun 4, 2020
cowtowncoder added a commit that referenced this pull request Jun 4, 2020
@frantuma frantuma deleted the yaml-quoting-2.11 branch June 4, 2020 08:06
MikeEdgar added a commit to smallrye/smallrye-open-api that referenced this pull request Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants