SetDefaultValues transforms a compose model to set default values to missing attributes
(yaml map[string]any)
| 39 | |
| 40 | // SetDefaultValues transforms a compose model to set default values to missing attributes |
| 41 | func SetDefaultValues(yaml map[string]any) (map[string]any, error) { |
| 42 | result, err := setDefaults(yaml, tree.NewPath()) |
| 43 | if err != nil { |
| 44 | return nil, err |
| 45 | } |
| 46 | return result.(map[string]any), nil |
| 47 | } |
| 48 | |
| 49 | func setDefaults(data any, p tree.Path) (any, error) { |
| 50 | for pattern, transformer := range DefaultValues { |
searching dependent graphs…