(schema: unknown)
| 595 | } |
| 596 | |
| 597 | function schemaShapeForHash(schema: unknown): unknown { |
| 598 | if (isObjectLike(schema)) { |
| 599 | try { |
| 600 | return stripJsonSchemaRuntimeFields( |
| 601 | toJSONSchema(schema as never, { |
| 602 | io: 'input', |
| 603 | target: 'draft-07', |
| 604 | unrepresentable: 'any', |
| 605 | cycles: 'ref', |
| 606 | reused: 'inline', |
| 607 | }), |
| 608 | ); |
| 609 | } catch { |
| 610 | // Fall through to structural canonicalization for plain JSON-schema-like objects. |
| 611 | } |
| 612 | } |
| 613 | return schema; |
| 614 | } |
| 615 | |
| 616 | function stripJsonSchemaRuntimeFields(value: unknown): unknown { |
| 617 | if (Array.isArray(value)) return value.map(stripJsonSchemaRuntimeFields); |
no test coverage detected