Extract the definition name from a $ref string (e.g., "#/definitions/Foo" → "Foo")
(schema: JSONSchema7 | null | undefined)
| 252 | |
| 253 | /** Extract the definition name from a $ref string (e.g., "#/definitions/Foo" → "Foo") */ |
| 254 | function extractRefName(schema: JSONSchema7 | null | undefined): string | null { |
| 255 | if (!schema?.$ref) return null; |
| 256 | // Handle cross-schema refs |
| 257 | const crossMatch = schema.$ref.match(/^[^#]+#\/definitions\/(.+)$/); |
| 258 | if (crossMatch) return crossMatch[1]; |
| 259 | return schema.$ref.replace(/^#\/definitions\//, ""); |
| 260 | } |
| 261 | |
| 262 | // ── Discriminated union support ───────────────────────────────────────────── |
| 263 |
no outgoing calls
no test coverage detected
searching dependent graphs…