fixEmptyNotNull is a workaround for https://github.com/xeipuuv/gojsonschema/issues/141 as go-yaml `[]` will load as a `[]any(nil)`, which is not the same as an empty array
(value any)
| 19 | // fixEmptyNotNull is a workaround for https://github.com/xeipuuv/gojsonschema/issues/141 |
| 20 | // as go-yaml `[]` will load as a `[]any(nil)`, which is not the same as an empty array |
| 21 | func fixEmptyNotNull(value any) interface{} { |
| 22 | switch v := value.(type) { |
| 23 | case []any: |
| 24 | if v == nil { |
| 25 | return []any{} |
| 26 | } |
| 27 | for i, e := range v { |
| 28 | v[i] = fixEmptyNotNull(e) |
| 29 | } |
| 30 | case map[string]any: |
| 31 | for k, e := range v { |
| 32 | v[k] = fixEmptyNotNull(e) |
| 33 | } |
| 34 | } |
| 35 | return value |
| 36 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…