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
k8s-merge-robot 2016-08-01 10:50:50 -07:00 committed by GitHub
commit ed763b8034
1 changed files with 0 additions and 4 deletions

View File

@ -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)
}