INNER CODE UNIT · Go
handleJSONSchemaPropsOrArray
pingcap/tidb-operator · cmd/crd-modifier/main.go:268
func handleJSONSchemaPropsOrArray(props *apiextensionsv1.JSONSchemaPropsOrArray, retainKeys []string) {
if props.Schema != nil {
handleJSONSchemaProps(props.Schema, retainKeys)
}
for i := range props.JSONSchemas {
s := &props.JSONSchemas[i]
handleJSONSchemaProps(s, retainKeys)
}
}
// intersection returns a new slice containing only the elements that exist in both input slices.
// If slice `b` is nil or empty, it will always return an empty slice.
// This is the mechanism used to clear the `required` fields from a schema property.
func intersection(a, b []string) []string {
var ret []string
for _, key := range a {
for _, retain := range b {
if key == retain {