(member: unknown)
| 450 | } |
| 451 | |
| 452 | const toPart = (member: unknown): Part | undefined => { |
| 453 | const schema = dereference(member) |
| 454 | if (schema === undefined) return undefined |
| 455 | if (isPlainObject(schema)) return { _tag: "Object", schema } |
| 456 | const mode = bareChoice(schema) |
| 457 | if (mode === undefined) return undefined |
| 458 | const branches: Array<JsonSchema.JsonSchema> = [] |
| 459 | for (const branch of schema[mode] as ReadonlyArray<unknown>) { |
| 460 | const resolved = dereference(branch) |
| 461 | if (resolved === undefined || !(isPlainObject(resolved) || excludesObject(resolved))) return undefined |
| 462 | branches.push(resolved) |
| 463 | } |
| 464 | return { _tag: "Choice", mode, branches } |
| 465 | } |
| 466 | |
| 467 | const compose = (js: JsonSchema.JsonSchema): JsonSchema.JsonSchema => { |
| 468 | // Sibling choices must both hold. |
no test coverage detected