INNER CODE UNIT · Go
handleJSONSchemaProps
pingcap/tidb-operator · cmd/crd-modifier/main.go:234
func handleJSONSchemaProps(props *apiextensionsv1.JSONSchemaProps, retainKeys []string) {
switch props.Type {
case "object":
switch {
case props.XMapType == nil || *props.XMapType == "granular":
// For granular maps, remove the `required` fields.
// The call to intersection with a `nil` retainKeys will clear the list.
props.Required = intersection(props.Required, retainKeys)
// Recursively process all child properties to ensure nested objects are also handled.
//nolint:gocritic
for key, val := range props.Properties {
handleJSONSchemaProps(&val, nil)
props.Properties[key] = val
}
case *props.XMapType == "atomic":
// Do not modify atomic maps.
return
}