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

Double quote YAML strings #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

daniel-shuy
Copy link
Contributor

@daniel-shuy daniel-shuy commented Nov 15, 2023

config-merge uses YAML.stringify() to format the merged output as YAML.

While YAML.stringify() outputs YAML version 1.2 by default (https://eemeli.org/yaml/#document-options), the merged output may be consumed/parsed by other applications that expect YAML version 1.1. This is normally not an issue, except when it comes to the yes/no strings. By default, YAML.stringify() formats strings unquoted. YAML version 1.2 parses unquoted yes/no strings as strings, while YAML version 1.1 parses unquoted yes/no strings as true/false booleans (https://eemeli.org/yaml/#version-differences).

An easy solution is to configure YAML.stringify() to double-quote all strings by default, by setting defaultStringType to QUOTE_DOUBLE (https://eemeli.org/yaml/#tostring-options).

@daniel-shuy
Copy link
Contributor Author

Hi @matthewdevenny, could you help to take a look at this PR? Thanks!

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.

1 participant