(value: unknown)
| 33 | } |
| 34 | |
| 35 | function stableStringify(value: unknown): string { |
| 36 | if (Array.isArray(value)) { |
| 37 | return `[${value.map(stableStringify).join(',')}]`; |
| 38 | } |
| 39 | if (isRecord(value)) { |
| 40 | const entries = Object.keys(value) |
| 41 | .sort() |
| 42 | .map((key) => `${JSON.stringify(key)}:${stableStringify(value[key])}`); |
| 43 | return `{${entries.join(',')}}`; |
| 44 | } |
| 45 | return JSON.stringify(value); |
| 46 | } |
| 47 | |
| 48 | function assertSchemaRef(ref: StructuredOutputSchemaRef): void { |
| 49 | if (!SCHEMA_PATTERN.test(ref.schema)) { |
no test coverage detected