mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
apiextensions: filter null types in ConvertJSONSchemaPropsToOpenAPIv2Schema
This commit is contained in:
parent
23b7d8b7b9
commit
f2e2f906c4
@ -62,12 +62,11 @@ func ConvertJSONSchemaPropsToOpenAPIv2Schema(in *apiextensions.JSONSchemaProps)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(p.Type) > 1 {
|
switch {
|
||||||
// https://github.com/kubernetes/kube-openapi/pull/143/files#diff-62afddb578e9db18fb32ffb6b7802d92R272
|
case len(p.Type) == 2 && (p.Type[0] == "null" || p.Type[1] == "null"):
|
||||||
// We also set Properties to null to enforce parseArbitrary at https://github.com/kubernetes/kube-openapi/blob/814a8073653e40e0e324205d093770d4e7bb811f/pkg/util/proto/document.go#L247
|
// https://github.com/kubernetes/kube-openapi/pull/143/files#diff-ce77fea74b9dd098045004410023e0c3R219
|
||||||
p.Type = nil
|
p.Type = nil
|
||||||
p.Properties = nil
|
case len(p.Type) == 1:
|
||||||
} else if len(p.Type) == 1 {
|
|
||||||
switch p.Type[0] {
|
switch p.Type[0] {
|
||||||
case "null":
|
case "null":
|
||||||
// https://github.com/kubernetes/kube-openapi/pull/143/files#diff-ce77fea74b9dd098045004410023e0c3R219
|
// https://github.com/kubernetes/kube-openapi/pull/143/files#diff-ce77fea74b9dd098045004410023e0c3R219
|
||||||
@ -80,7 +79,12 @@ func ConvertJSONSchemaPropsToOpenAPIv2Schema(in *apiextensions.JSONSchemaProps)
|
|||||||
p.Items = nil
|
p.Items = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
case len(p.Type) > 1:
|
||||||
|
// https://github.com/kubernetes/kube-openapi/pull/143/files#diff-62afddb578e9db18fb32ffb6b7802d92R272
|
||||||
|
// We also set Properties to null to enforce parseArbitrary at https://github.com/kubernetes/kube-openapi/blob/814a8073653e40e0e324205d093770d4e7bb811f/pkg/util/proto/document.go#L247
|
||||||
|
p.Type = nil
|
||||||
|
p.Properties = nil
|
||||||
|
default:
|
||||||
// https://github.com/kubernetes/kube-openapi/pull/143/files#diff-62afddb578e9db18fb32ffb6b7802d92R248
|
// https://github.com/kubernetes/kube-openapi/pull/143/files#diff-62afddb578e9db18fb32ffb6b7802d92R248
|
||||||
p.Properties = nil
|
p.Properties = nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user