You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New approach to #2562.
I'm considering to remove the feature of transforming examples and
devote to users its proper placement.
The native metadata examples are typed as `z.output<>` of the schema,
which is the opposite of what it used to be established by the
framework.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,13 @@
13
13
- the temporary nature of this transition;
14
14
- the advantages of Zod 4 that provide opportunities to simplifications and corrections of known issues.
15
15
-`IOSchema` type had to be simplified down to a schema resulting to an `object`, but not an `array`;
16
-
- Despite supporting examples by the new Zod method `.meta()`, users should still use `.example()` to set them;
17
16
- Refer to [Migration guide on Zod 4](https://v4.zod.dev/v4/changelog) for adjusting your schemas;
18
-
- Generating Documentation is partially delegated to Zod 4 `z.toJSONSchema()`:
17
+
- Changes to `ZodType::example()` (Zod plugin method):
18
+
- Now acts as an alias for `ZodType::meta({ examples })`;
19
+
- The argument has to be the output type of the schema (used to be the opposite):
20
+
- This change is only breaking for transforming schemas;
21
+
- In order to specify an input example for a transforming schema the `.example()` method must be called before it;
22
+
- Generating Documentation is mostly delegated to Zod 4 `z.toJSONSchema()`:
19
23
- The basic depiction of each schema is now natively performed by Zod 4;
20
24
- Express Zod API implements some overrides and improvements to fit it into OpenAPI 3.1 that extends JSON Schema;
21
25
- The `numericRange` option removed from `Documentation` class constructor argument;
@@ -26,6 +30,7 @@
26
30
- Use `.or(z.undefined())` to add `undefined` to the type of the object property;
-`z.any()` and `z.unknown()` are not optional, details: https://v4.zod.dev/v4/changelog#changes-zunknown-optionality.
33
+
- The `getExamples()` public helper removed — use `.meta()?.examples` instead;
29
34
- Consider the automated migration using the built-in ESLint rule.
0 commit comments