MCPcopy Index your code
hub / github.com/docker/cli / ParseYAML

Function ParseYAML

cli/compose/loader/loader.go:62–76  ·  view source on GitHub ↗

ParseYAML reads the bytes from a file, parses the bytes into a mapping structure, and returns it.

(source []byte)

Source from the content-addressed store, hash-verified

60// ParseYAML reads the bytes from a file, parses the bytes into a mapping
61// structure, and returns it.
62func ParseYAML(source []byte) (map[string]any, error) {
63 var cfg any
64 if err := yaml.Unmarshal(source, &cfg); err != nil {
65 return nil, err
66 }
67 _, ok := cfg.(map[string]any)
68 if !ok {
69 return nil, errors.New("top-level object must be a mapping")
70 }
71 converted, err := convertToStringKeysRecursive(cfg, "")
72 if err != nil {
73 return nil, err
74 }
75 return converted.(map[string]any), nil
76}
77
78// Load reads a ConfigDetails and returns a fully loaded configuration
79func Load(configDetails types.ConfigDetails, opt ...func(*Options)) (*types.Config, error) {

Callers 9

TestMarshallConfigFunction · 0.85
TestJSONMarshallConfigFunction · 0.85
loadYAMLWithEnvFunction · 0.85
TestParseYAMLFunction · 0.85
TestDiscardEnvFileOptionFunction · 0.85
TestBuildPropertiesFunction · 0.85
TestDeprecatedPropertiesFunction · 0.85

Calls 1

Tested by 9

TestMarshallConfigFunction · 0.68
TestJSONMarshallConfigFunction · 0.68
loadYAMLWithEnvFunction · 0.68
TestParseYAMLFunction · 0.68
TestDiscardEnvFileOptionFunction · 0.68
TestBuildPropertiesFunction · 0.68
TestDeprecatedPropertiesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…