fix(xsschema): fixes zod v4 converting to json schema draft 2020 instead of 07 (#227)

- resolves #226
This commit is contained in:
Ralph Khreish authored and GitHub committed 2025-10-19 17:17:40 +08:00
1 parent 7e315ddc7a
commit abf99563c2
1 file changed
+2 -1
+2 -1
View File
@@ -16,7 +16,8 @@ export const getToJsonSchemaFn = async (): Promise<ToJsonSchemaFn> => {
try {
// https://zod.dev/library-authors?id=how-to-support-zod-and-zod-mini-simultaneously#how-to-support-zod-and-zod-mini-simultaneously
const { toJSONSchema } = await import('zod/v4/core')
zodV4toJSONSchema = toJSONSchema as ToJsonSchemaFn
// Zod v4 defaults to Draft 2020-12, but we need Draft 07
zodV4toJSONSchema = ((schema: unknown) => toJSONSchema(schema as $ZodType, { target: 'draft-7' })) as ToJsonSchemaFn
}
catch (err) {
if (err instanceof Error)