| 373 | } |
| 374 | |
| 375 | function normalizeZodJsonSchema(value: unknown): unknown { |
| 376 | if (Array.isArray(value)) return value.map((item) => normalizeZodJsonSchema(item)) |
| 377 | if (typeof value !== "object" || value === null) return value |
| 378 | return Object.fromEntries( |
| 379 | Object.entries(value) |
| 380 | .filter((entry) => |
| 381 | (entry[0] === "exclusiveMaximum" || entry[0] === "exclusiveMinimum") && typeof entry[1] === "boolean" |
| 382 | ? false |
| 383 | : true, |
| 384 | ) |
| 385 | .map(([key, item]) => [key, normalizeZodJsonSchema(item)]), |
| 386 | ) |
| 387 | } |
| 388 | |
| 389 | function isJsonSchemaObject(value: unknown): value is Record<string, unknown> { |
| 390 | return typeof value === "object" && value !== null && !Array.isArray(value) |