Repository navigation
zod-parity: a CLI that checks where Zod 4 and its generated JSON Schema disagree #6667
mangomac
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I built a small CLI that loads your Zod 4 schemas, generates boundary samples, and runs the same JSON values through Zod and through Ajv against Zod's own generated JSON Schema. It prints each input where the two disagree, with the error paths.
Example with z.number().multipleOf(0.1) and the value 0.3: Zod accepts it, the generated JSON Schema (Ajv, default precision) rejects it. That is a floating-point difference, not a claimed converter bug. Ajv's multipleOfPrecision would change it.
It is early (v0.1). Sampling is not proof of equivalence, and a difference is not automatically a Zod bug. Refinements, transforms and coercion are not covered.
npx zod-parity ./schemas.ts
npm: https://www.npmjs.com/package/zod-parity
repo: https://github.com/mangomac/zod-parity
If it is a fit for the ecosystem page I would be glad to be listed. Feedback on false positives is welcome.
All reactions