MCPcopy Create free account
hub / github.com/compose-spec/compose-go / SetDefaultValues

Function SetDefaultValues

transform/defaults.go:41–47  ·  view source on GitHub ↗

SetDefaultValues transforms a compose model to set default values to missing attributes

(yaml map[string]any)

Source from the content-addressed store, hash-verified

39
40// SetDefaultValues transforms a compose model to set default values to missing attributes
41func 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
49func setDefaults(data any, p tree.Path) (any, error) {
50 for pattern, transformer := range DefaultValues {

Callers 2

loadYamlModelFunction · 0.92
TestRegisterDefaultValueFunction · 0.85

Calls 2

NewPathFunction · 0.92
setDefaultsFunction · 0.85

Tested by 1

TestRegisterDefaultValueFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…