|
6 | 6 |
|
7 | 7 | - Switched to Zod 4: |
8 | 8 | - Minimum supported version of `zod` is 3.25.1, BUT imports MUST be from `zod/v4`; |
9 | | - - Explanation of the versioning strategy: https://github.com/colinhacks/zod/issues/4371; |
| 9 | + - Read the [Explanation of the versioning strategy](https://github.com/colinhacks/zod/issues/4371); |
10 | 10 | - Express Zod API, however, is not aiming to support both Zod 3 and Zod 4 simultaneously due to: |
11 | 11 | - incompatibility of data structures; |
12 | 12 | - operating composite schemas (need to avoid mixing schemas of different versions); |
|
21 | 21 | - In order to specify an example for an input schema the `.example()` method must be called before `.transform()`; |
22 | 22 | - The transforming proprietary schemas `ez.dateIn()` and `ez.dateOut()` now accept metadata as its argument: |
23 | 23 | - This allows to set examples before transformation (`ez.dateIn()`) and to avoid the examples "branding"; |
24 | | -- Generating Documentation is mostly delegated to Zod 4 `z.toJSONSchema()`: |
25 | | - - The basic depiction of each schema is now natively performed by Zod 4; |
| 24 | +- Changes to `Documentation`: |
| 25 | + - Generating Documentation is mostly delegated to Zod 4 `z.toJSONSchema()`; |
26 | 26 | - Express Zod API implements some overrides and improvements to fit it into OpenAPI 3.1 that extends JSON Schema; |
27 | 27 | - The `numericRange` option removed from `Documentation` class constructor argument; |
28 | 28 | - The `Depicter` type signature changed: became a postprocessing function returning an overridden JSON Schema; |
29 | | -- The `optionalPropStyle` option removed from `Integration` class constructor: |
| 29 | +- Changes to `Integration`: |
| 30 | + - The `optionalPropStyle` option removed from `Integration` class constructor: |
30 | 31 | - Use `.optional()` to add question mark to the object property as well as `undefined` to its type; |
31 | 32 | - Use `.or(z.undefined())` to add `undefined` to the type of the object property; |
32 | | - - Reasoning: https://x.com/colinhacks/status/1919292504861491252; |
33 | | - - `z.any()` and `z.unknown()` are not optional, details: https://v4.zod.dev/v4/changelog#changes-zunknown-optionality. |
34 | | -- The argument of `ResultHandler::handler` is now discriminated: either `output` or `error` is null, not both; |
| 33 | + - See the [reasoning](https://x.com/colinhacks/status/1919292504861491252); |
| 34 | + - `z.any()` and `z.unknown()` are required: [details](https://v4.zod.dev/v4/changelog#changes-zunknown-optionality); |
| 35 | + - Added types generation for `z.never()`, `z.void()` and `z.unknown()` schemas; |
| 36 | + - The fallback type for unsupported schemas and unclear transformations in response changed from `any` to `unknown`; |
| 37 | +- The argument of `ResultHandler::handler` is now discriminated: either `output` or `error` is `null`, not both; |
35 | 38 | - The `getExamples()` public helper removed — use `.meta()?.examples` instead; |
36 | | -- The `ez.file()` schema removed: use `z.string()`, `z.base64()` or the new `ez.buffer()` instead; |
| 39 | +- Added the new proprietary schema `ez.buffer()`; |
| 40 | +- The `ez.file()` schema removed: use `z.string()`, `z.base64()`, `ez.buffer()` or their union; |
37 | 41 | - Consider the automated migration using the built-in ESLint rule. |
38 | 42 |
|
39 | 43 | ```js |
|
0 commit comments