UnmarshalJSON implements custom JSON marshalling
(payload []byte)
| 31 | |
| 32 | // UnmarshalJSON implements custom JSON marshalling |
| 33 | func (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 |
| 53 | func GetDockerContext(storeMetadata store.Metadata) (DockerContext, error) { |
no outgoing calls
no test coverage detected