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

Bugfix (v3): Marshal yaml 1.1 bool strings as explicit strings #490

Closed
wants to merge 6 commits into from

Conversation

laverya
Copy link
Contributor

@laverya laverya commented Jul 22, 2019

String values matching a boolean literal from the yaml 1.1 spec should be rendered with quotes to ensure backwards compatibility. This fixes #489.

@laverya
Copy link
Contributor Author

laverya commented Jul 22, 2019

Well that's interesting
Running this locally worked for me, but TravisCI disagrees (except with the latest golang?)

I'll have to look into that

@laverya
Copy link
Contributor Author

laverya commented Jul 22, 2019

Seems it was the CI import path
Travis was running the test cases against the current v3 code, not against the code in the PR
Another reason to really require merging #485 soon, I suppose

@laverya laverya changed the title Marshal yaml 1.1 bool strings as explicit strings Bugfix (v3): Marshal yaml 1.1 bool strings as explicit strings Nov 5, 2019
@ppmathis
Copy link

@niemeyer Could you please consider merging this PR? I'm currently using go-yaml v3 to unmarshal a YAML file, make some changes to a few structs and marshal it back into YAML. Due to this specific bug, test: 'yes' turns into test: yes, which therefore changes the type from string to boolean.

@laverya
Copy link
Contributor Author

laverya commented Feb 18, 2020

this also fixes #214, which the issue I opened is a dupe of...

@laverya
Copy link
Contributor Author

laverya commented Mar 20, 2020

Obsoleted by #583 .

@laverya laverya closed this Mar 20, 2020
return true
case "n", "N", "no", "No", "NO", "off", "Off", "OFF":
out.SetBool(false)
val, found := boolMap[resolved]
Copy link

Choose a reason for hiding this comment

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

Will this still decode y as true?

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.

3 participants