(schema: JsonSchema, root: JsonSchema)
| 65 | * oneOf/anyOf so we can inspect the concrete shape. |
| 66 | */ |
| 67 | const deepResolve = (schema: JsonSchema, root: JsonSchema): JsonSchema => { |
| 68 | let s = schema; |
| 69 | if (s.$ref) { |
| 70 | const resolved = resolveRef(s.$ref, root); |
| 71 | if (resolved) s = resolved; |
| 72 | } |
| 73 | // Unwrap single-variant unions |
| 74 | if (s.oneOf?.length === 1) s = deepResolve(s.oneOf[0]!, root); |
| 75 | if (s.anyOf?.length === 1) s = deepResolve(s.anyOf[0]!, root); |
| 76 | return s; |
| 77 | }; |
| 78 | |
| 79 | // --------------------------------------------------------------------------- |
| 80 | // Type label — human readable, shows ref names |
no test coverage detected