INNER CODE UNIT · Go

handleSelectedJSONSchemaProps

pingcap/tidb-operator · cmd/crd-modifier/main.go:209

func handleSelectedJSONSchemaProps(props *apiextensionsv1.JSONSchemaProps, keys ...string) {
	if len(keys) == 0 {
		// When the target path is reached, call handleJSONSchemaProps to remove the required fields.
		// `nil` is passed for retainKeys, which means no keys should be retained (i.e., all are removed).
		handleJSONSchemaProps(props, nil)
		return
	}

	key := keys[0]
	child, ok := props.Properties[key]
	if !ok {
		// If the path doesn't exist in the schema, it means this CRD doesn't have the expected structure.
		// This is not an error - just skip processing this path silently.
		fmt.Printf("Path %v not found in schema, skipping...\n", keys)
		return
	}
	// Recurse into the next level of the schema.
	handleSelectedJSONSchemaProps(&child, keys[1:]...)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…