Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #10156
Context
ruamel.yamlversion0.17.23added a heuristic to determine when adding backslashes in wrapped quoted strings is necessary changelog. This seems technically compliant but downstream consumers with a different YAML parser may not be compatible with the change. This PR fixes the issue by creating a custom Emitter class that overrides the method responsible for writing double quoted values, restoring the pre-0.17.23behavior, unconditionally adding backslashes.Considered but dropped
yaml.widthto an impossibly high value likefloat('inf')so that there are never line breaks. Without line breaks, there wouldn't be a need for the backslashes. This was not pursued because it may produce extremely long lines that may cause buffering issues for consumers when reading line-by-line. It also changes the output behavior from previous AWS CLI versions and consumers may be depending on consistent formatting.ruamel.yamlversions instead of pinning a specific version, it wouldn't make sense. I'm also not sure in general how valuable it is to limit drift if the emitter works fine for the AWS CLI's use case.Confirmed that the original output is restored given the test template in the referenced issue: