( write: () => JsonSchema, byTarget: readonly ((() => JsonSchema) | 0)[], // no fallback wrote it, so a call's changes nothing ignoresFallback?: 1 )
| 648 | |
| 649 | // a target's is 0 where the validator doesn't bake its schema |
| 650 | export const bakedJsonSchema = ( |
| 651 | write: () => JsonSchema, |
| 652 | byTarget: readonly ((() => JsonSchema) | 0)[], |
| 653 | // no fallback wrote it, so a call's changes nothing |
| 654 | ignoresFallback?: 1 |
| 655 | ): ((opts?: JsonSchemaOptions) => JsonSchema) => |
| 656 | freeze((opts?: JsonSchemaOptions) => { |
| 657 | const target = bakedTargetOf(opts, !!ignoresFallback) |
| 658 | const written = target === undefined ? write : byTarget[target] |
| 659 | return written ? written() : throwError(bakedJsonSchemaOptionsMessage) |
| 660 | }) |
| 661 | |
| 662 | // a baked schema written again with the fallback a call passes, as the build |
| 663 | // recorded arktype writing it; a target's replay is 0 where it has none |
no test coverage detected