Skip to content

v7.0.0

Compare
Choose a tag to compare
@AGalabov AGalabov released this 05 Apr 10:15
· 6 commits to master since this release

What's Changed

  • Added ESM modules export alongside the already present CJS (#219)
  • Added support for .refine() and .transform on ZodObjects in request query/params/headers/cookies (#198)

BREAKING CHANGES ⚠️

❗ None of the changes that we've made are breaking in terms of code integration but their behavior (result) is changed:

Handle zod tuples with prefixItems for OpenAPI v3.1.0 (#221 )

As of OpenAPI v3.1.0 there is a better representation of tuples - ordered items with the use of the prefixItems keyword. See more here

BigInt is now transformed as type string

z.bigint() // this is now transformed to `{ type: 'string', pattern: "^\d+$' }` instead of an `'integer'` type.

A BigInt can represent a number with a arbitrary size and that also means numbers that do not fall in the int64 format. As such for a library based on the JS world it is safer to represent a z.bigint() instance as a string containing only digits. In a real life scenario a BigInt instance can only be created from whatever was passed through HTTPS - and that can be both number and string as a basis.

Along with that the support for the minimum and maximum values have been removed.

Full Changelog: v6.4.0...v7.0.0