(prop map[string]any)
| 105 | } |
| 106 | |
| 107 | func removeNullFromType(prop map[string]any) { |
| 108 | typeVal, exists := prop["type"] |
| 109 | if !exists { |
| 110 | return |
| 111 | } |
| 112 | arr, ok := typeVal.([]any) |
| 113 | if !ok { |
| 114 | return |
| 115 | } |
| 116 | |
| 117 | filtered := arr[:0] |
| 118 | for _, t := range arr { |
| 119 | if s, ok := t.(string); ok && s == "null" { |
| 120 | continue |
| 121 | } |
| 122 | filtered = append(filtered, t) |
| 123 | } |
| 124 | |
| 125 | switch len(filtered) { |
| 126 | case 0: |
| 127 | // All entries were "null"; leave the schema alone. |
| 128 | case 1: |
| 129 | prop["type"] = filtered[0] |
| 130 | default: |
| 131 | prop["type"] = filtered |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | // ensurePropertyTypes recursively walks a JSON Schema map and ensures |
| 136 | // every property has a "type" set, defaulting to "object" if missing. |
no outgoing calls
no test coverage detected