Created
September 12, 2019 16:48
-
-
Save sttts/0d8a75db15d1e590eef202fb2b32f63c to your computer and use it in GitHub Desktop.
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
diff --git a/vendor/k8s.io/kubernetes/staging/src/k8s.io/apiextensions-apiserver/pkg/controller/openapi/builder/builder.go b/vendor/k8s.io/kubernetes/staging/src/k8s.io/apiextensions-apiserver/pkg/controller/openapi/builder/builder.go | |
index d13e0437c2..6658f4f649 100644 | |
--- a/vendor/k8s.io/kubernetes/staging/src/k8s.io/apiextensions-apiserver/pkg/controller/openapi/builder/builder.go | |
+++ b/vendor/k8s.io/kubernetes/staging/src/k8s.io/apiextensions-apiserver/pkg/controller/openapi/builder/builder.go | |
@@ -88,17 +88,19 @@ func BuildSwagger(crd *apiextensions.CustomResourceDefinition, version string, o | |
if s != nil && s.OpenAPIV3Schema != nil { | |
if !validation.SchemaHasInvalidTypes(s.OpenAPIV3Schema) { | |
if ss, err := structuralschema.NewStructural(s.OpenAPIV3Schema); err == nil { | |
- // skip non-structural schemas | |
- schema = ss | |
- | |
- if opts.StripDefaults { | |
- schema = schema.StripDefaults() | |
- } | |
- if opts.StripValueValidation { | |
- schema = schema.StripValueValidations() | |
+ if errs := structuralschema.ValidateStructural(nil, ss); len(errs) == 0 { | |
+ // skip non-structural schemas | |
+ schema = ss | |
+ | |
+ if opts.StripDefaults { | |
+ schema = schema.StripDefaults() | |
+ } | |
+ if opts.StripValueValidation { | |
+ schema = schema.StripValueValidations() | |
+ } | |
+ | |
+ schema = schema.Unfold() | |
} | |
- | |
- schema = schema.Unfold() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment