orval
orval copied to clipboard
Zod: preprocess enable except on response?
Thanks developers for this awesome tool.
I have a question for zod preprocess.
Expectation
zod preprocess is enabled on body. (In my environment, preprocess is enabled on response only)
Version
System:
OS: macOS 13.6.7
CPU: (8) arm64 Apple M1 Pro
Memory: 84.08 MB / 32.00 GB
Shell: 3.2.57 - /bin/bash
npmPackages:
axios: ^1.7.4 => 1.7.4
msw: ^2.3.0 => 2.3.0
orval: ^7.0.1 => 7.0.1
react: ^18 => 18.3.1
swr: ^2.2.5 => 2.2.5
zod: ^3.23.8 => 3.23.8
My configuration
https://orval.dev/reference/configuration/output#preprocess
orval.config.js
module.exports = {
client: {
input: {
target: './swagger.yaml',
},
output: {
mode: 'tags-split',
client: 'swr',
target: 'src/gen/endpoints',
schemas: 'src/gen/models',
mock: true,
},
},
zod: {
input: {
target: './swagger.yaml',
},
output: {
mode: 'tags-split',
client: 'zod',
target: 'src/gen/endpoints',
fileExtension: '.zod.ts',
override: {
zod: {
strict: {
response: true,
query: true,
param: true,
header: true,
body: true
},
coerce: {
response: true,
query: true,
param: true,
header: true,
body: true
},
preprocess: {
body: { // This does not work
name: 'bar',
path: './src/mutators.ts',
},
},
},
},
},
},
}