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

Add ? to the list of things to quote when it's an exact value. #178

Merged
merged 6 commits into from
Dec 27, 2023

Conversation

mlwilkerson
Copy link
Contributor

Closes #177

The linked issue includes the full description of the problem this resolves, with reproduction, and notes from the YAML spec. The particularly relevant sections of the spec are:

  • 5.3 - the ? character is used as an indicator character, indicating a mapping key
  • 7.3.3 - the ? character can only be encoded in Plain Style when it's followed by a non-space "safe" character.

The proposed fix is to add ? to the list of values already being considered for quotation when they appear as exact values.


Requirements

  • Entry in CHANGELOG.md was created
  • Link to documentation on https://yaml.org/ is provided in the PR description
  • Functionality is covered by newly created tests

Copy link
Collaborator

@mruoss mruoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the PR and for taking the time to look up and link the documentation. Reading it, made me think we should add tests for all indicator chars if they're on their own. See the comment on the diff.

test/ymlr/encode_test.exs Outdated Show resolved Hide resolved
@mruoss mruoss merged commit f6dd284 into ufirstgroup:main Dec 27, 2023
18 checks passed
@mruoss
Copy link
Collaborator

mruoss commented Dec 27, 2023

Thanks a lot!

@mlwilkerson mlwilkerson deleted the quote-question branch December 27, 2023 19:33
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.

lone question mark scalar should be quoted, not encoded in Plain Style
2 participants