enumOf returns the enum string slice for a property, or nil if absent.
(props map[string]any, field string)
| 59 | |
| 60 | // enumOf returns the enum string slice for a property, or nil if absent. |
| 61 | func enumOf(props map[string]any, field string) []string { |
| 62 | p, ok := props[field].(map[string]any) |
| 63 | if !ok { |
| 64 | return nil |
| 65 | } |
| 66 | raw, ok := p["enum"].([]any) |
| 67 | if !ok { |
| 68 | return nil |
| 69 | } |
| 70 | out := make([]string, 0, len(raw)) |
| 71 | for _, v := range raw { |
| 72 | if s, ok := v.(string); ok { |
| 73 | out = append(out, s) |
| 74 | } |
| 75 | } |
| 76 | return out |
| 77 | } |
| 78 | |
| 79 | // typeIsNullable reports whether a property's type includes "null" |
| 80 | // (either as a list ["array","null"] or via a separate nullable flag). |
no test coverage detected