-
Notifications
You must be signed in to change notification settings - Fork 899
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
Use yaml.v3 instead of modified yaml.v2 for handling YAML files #791
Merged
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f61dbe2
Add another test (that currently fails).
felixfontein 75bd91e
First shot at using yaml.v3 for reading YAML files with comments.
felixfontein 840f45c
Allow parsing multi-document YAML files.
felixfontein 1cb55be
Use Decoder to parse multi-part documents.
felixfontein fadc415
Use yaml.v3 for config and audit.
felixfontein 1c3ba93
First step of serializing YAML using yaml.v3.
felixfontein 7780ea2
Always serialize with yaml.v3.
felixfontein 9c88101
Remove debug prints.
felixfontein 796084a
Remove traces of github.com/mozilla-services/yaml.
felixfontein 61ca8c8
Improve serialization of documents consisting only of comments.
felixfontein f6c066b
Improve handling of some empty documents.
felixfontein a4f9d11
Adjust to latest changes in go-yaml/yaml#684.
felixfontein c82c500
Bump yaml.v3 version, temporarily disable failing tests.
felixfontein b9f667a
Run go mod tidy.
felixfontein ab081ea
Fix CI.
felixfontein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Improve serialization of documents consisting only of comments.
- Loading branch information
commit 61ca8c8d499e433b92572597e402f2cc0ca5448c
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you tell me what this does?
This looks cause #907 , and removing this looks cause nothing bad (as I don't know what good this does).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #908
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is needed so that empty document works well with go-yaml/yaml#690. Unfortunately that fix for yaml.v3 isn't progressing, so I guess for now we can remove that branch. Once that fix landed in yaml.v3, this branch is definitely needed though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the behavior of
sops
with your implementation of yaml.v3 by replacing in go.mod:(35d69a41298b is the last commit of https://github.com/felixfontein/yaml/tree/improve-empty-document-handling)
It results
sops
confuse "no document" and "empty mapping":They are distinguished in yaml: http://ben-kiki.org/ypaste/data/21512/index.html
Unfortunately, the internal structure of
sops
(TreeBranch
) cannot distinguish "no document" and "empty mapping".I think we need to extend
TreeBranch
to have a flag that indicates "no document".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. The need to represent "no document" seems to be more important than "empty mapping" - see #695 (comment). I haven't seen (or at least can't remember :) ) any request yet for being able to recover
{}
.I don't think it can be solved that simply. While this works when cycling between YAML and the internal data structures, it does not help at all when a YAML file is encrypted. Adjusting the metadata won't help since that will not work for multi-document YAML files (metadata is only there once per YAML file).