mirror of https://github.com/k3s-io/k3s
Merge pull request #29419 from wangxing1517/remove_redundant_ToJSON
Automatic merge from submit-queue Remove redundant ToJSON <!-- Checklist for submitting a Pull Request Please remove this comment block before submitting. 1. Please read our [contributor guidelines](https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md). 2. See our [developer guide](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md). 3. If you want this PR to automatically close an issue when it is merged, add `fixes #<issue number>` or `fixes #<issue number>, fixes #<issue number>` to close multiple issues (see: https://github.com/blog/1506-closing-issues-via-pull-requests). 4. Follow the instructions for [labeling and writing a release note for this PR](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes) in the block below. --> ToJSON in pkg/kubectl/resource/visitor.go#ValidateSchema is unnecessary, because "data" will be checked in schema.ValidateBytes [pkg/api/validation/schema.go] shortly.pull/6/head
commit
ed763b8034
|
@ -207,10 +207,6 @@ func ValidateSchema(data []byte, schema validation.Schema) error {
|
|||
if schema == nil {
|
||||
return nil
|
||||
}
|
||||
data, err := yaml.ToJSON(data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error converting to YAML: %v", err)
|
||||
}
|
||||
if err := schema.ValidateBytes(data); err != nil {
|
||||
return fmt.Errorf("error validating data: %v; %s", err, stopValidateMessage)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue