-
Notifications
You must be signed in to change notification settings - Fork 76
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
Switch to 'yaml.v3' #100
Switch to 'yaml.v3' #100
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: inteon The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
600f900
to
9c0c75c
Compare
@@ -119,6 +123,7 @@ func (dec *Decoder) KnownFields(enable bool) { | |||
func (dec *Decoder) Decode(v interface{}) (err error) { | |||
d := newDecoder() | |||
d.knownFields = dec.knownFields | |||
d.uniqueKeys = !dec.noUniqueKeys |
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.
This exising uniqueKeys
option is exposed for the non-strict unmarshaller.
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.
Is this new? I don't remember this option in the v2 decoder. I didn't expect new capabilities to be added in the v2 → v3 switch
9c0c75c
to
b2efacf
Compare
@@ -196,6 +211,15 @@ func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (in | |||
} | |||
} | |||
|
|||
// Transform map[string]interface{} into map[interface{}]interface{} |
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.
Is the need for this new? What is the cost of this?
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.
Yes, yamlv3 unmarshals maps into map[string]interface{}
if all keys are strings, while yamlv2 did unmarshal all maps into map[interface{}]interface{}
.
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.
JSON only deals with map[string]interface{}, and it will marshal the same… do we need to convert back to map[interface{}]interface{}?
@@ -227,7 +251,7 @@ func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (in | |||
// Stolen from go-yaml to use the same conversion to string as | |||
// the go-yaml library uses to convert float to string when | |||
// Marshaling. | |||
s := strconv.FormatFloat(typedKey, 'g', -1, 32) | |||
s := strconv.FormatFloat(typedKey, 'g', -1, 64) |
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.
Will this result in visibly different output? Any changes have the potential to break consumers so we need to be extremely careful about changes that break byte-for-byte round-tripping
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.
There's a lot more changes than I expected, and I'm not very familiar with what they are doing, so it's hard to tell if this is strictly dropping unused code or is changing behavior
After digging through several layers of transitive dependencies, I've discovered that this PR will solve a YAML parsing issue in a downstream application that uses |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Switches from the 'yaml.v2' fork to the 'yaml.v3' fork and removes workarounds that are no longer necessary.