Skip to content

Commit f366da0

Browse files
Version Packages (#481)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 9fff32c commit f366da0

File tree

3 files changed

+39
-38
lines changed

3 files changed

+39
-38
lines changed

.changeset/moody-books-cover.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,43 @@
11
# zod-openapi
22

3+
## 5.2.0
4+
5+
### Minor Changes
6+
7+
- [#480](https://github.com/samchungy/zod-openapi/pull/480) [`5c3f98a`](https://github.com/samchungy/zod-openapi/commit/5c3f98a49a4377819b93993fb92a84510f794d28) Thanks [@samchungy](https://github.com/samchungy)! - Change `ZodUndefined` behaviour
8+
9+
This restores how `z.undefined()` is rendered to pre Zod v3.25.75.
10+
11+
It is now rendered as:
12+
13+
```json
14+
{
15+
"not": {}
16+
}
17+
```
18+
19+
If you want to override this behaviour you can customise this with the `override` function passed into the `createDocument` function.
20+
21+
eg.
22+
23+
```ts
24+
import { createDocument } from 'zod-openapi';
25+
26+
createDocument(
27+
z.object({
28+
name: z.undefined().optional(),
29+
}),
30+
{
31+
override: (ctx) => {
32+
if (ctx.zodSchema._zod.def.type === 'undefined') {
33+
// This will change the behaviour back to throwing an error
34+
delete ctx.jsonSchema.not;
35+
}
36+
},
37+
},
38+
);
39+
```
40+
341
## 5.1.1
442

543
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zod-openapi",
3-
"version": "5.1.1",
3+
"version": "5.2.0",
44
"description": "Convert Zod Schemas to OpenAPI v3.x documentation",
55
"keywords": [
66
"typescript",

0 commit comments

Comments
 (0)