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

Method UnmarshalJSON

cli/command/context.go:33–50  ·  view source on GitHub ↗

UnmarshalJSON implements custom JSON marshalling

(payload []byte)

Source from the content-addressed store, hash-verified

31
32// UnmarshalJSON implements custom JSON marshalling
33func (dc *DockerContext) UnmarshalJSON(payload []byte) error {
34 var data map[string]any
35 if err := json.Unmarshal(payload, &data); err != nil {
36 return err
37 }
38 for k, v := range data {
39 switch k {
40 case "Description":
41 dc.Description = v.(string)
42 default:
43 if dc.AdditionalFields == nil {
44 dc.AdditionalFields = make(map[string]any)
45 }
46 dc.AdditionalFields[k] = v
47 }
48 }
49 return nil
50}
51
52// GetDockerContext extracts metadata from stored context metadata
53func GetDockerContext(storeMetadata store.Metadata) (DockerContext, error) {

Callers 1

buildPutManifestRequestFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected