v2.15.0
What's Changed
New Features 🎉
-
Support OpenAPI 3.1
const
value by @samchungy in #240ZodLiteral values will now be represented using the const keyword instead of a single value enum array in OpenAPI 3.1.0.
The following object, this will be now rendered as such:
z.object({ foo: z.literal('foo') });
foo: type: 'string' - enum: - - 'foo' + const: 'foo'
Other Changes
z.literal(undefined)
is now treated the same way asz.undefined()
when used in objects.z.literal(null)
is now treated the same way asz.null()
.
Full Changelog: v2.14.0...v2.15.0