in pkg/build/patchbuild.go [160:187]
func addParamDefaults(prefix string, props map[string]apiextensions.JSONSchemaProps, op options.JSONOptions) error {
for k, val := range props {
tmplKey := prefix + "." + k
if val.Properties != nil {
// The schema indicates that the this key-value pair has an object
// substructure, and so we have to recurse into this structure.
var nestedOpts options.JSONOptions
optVal, hasVal := op[k]
if hasVal && optVal != nil {
nopt, ok := optVal.(map[string]interface{})
if !ok {
return fmt.Errorf("Option value with key %q was expected to be an object-type, but was %v", tmplKey, optVal)
}
nestedOpts = nopt
} else {
nestedOpts = make(options.JSONOptions)
op[k] = nestedOpts
}
// This property contains nested properties. Recurse into these
// properties and modify the prefix
addParamDefaults(tmplKey, val.Properties, nestedOpts)
} else {
op[k] = `{{` + tmplKey + `}}`
}
}
return nil
}