orval
orval copied to clipboard
Zod generate big files
What are the steps to reproduce this issue?
- have big API documentation
- run zod output to generate schema
- files generated bigger than 1MB
What happens?
Running lint and project performance decrease
What were you expecting to happen?
Use zod objects for relation data
Any logs, error output, etc?
/src/api/schemas/xyz.ts lint ━━━━━━━━━━
× Size of src/api/schemas/xyz.ts is 1.2 MiB which exceeds configured maximum of 1.0 MiB for this project.
The file size limit exists to prevent us inadvertently slowing down and loading large files that we shouldn't.
Use the `files.maxSize` configuration to change the maximum size of files processed.
Any other comments?
Add ability to exclude some type of generations for example I don't need to generate zod validation for responses
What versions are you using?
| What versions are you using? | |
|---|---|
| Operating System | MacOS sonoma |
| Package Version | v6.30.2 |
| Browser Version | Chrome Version 126.0.6478.115 (Official Build) (arm64) |
| Node Version | v20.14.0 |
Suggestion
export default defineConfig({
xyzProject: {
output: {
mode: 'tags',
workspace: 'src/api',
schemas: './model',
target: './schemas',
indexFiles: true,
client: 'zod',
mock: false,
biome: true,
override: {
header: false,
useDates: true,
useNamedParameters: true,
useNativeEnums: true,
zod: {
// this can be a temporary solution
generate: {
response: false,
body: true,
query: true,
},
// end of solution
coerce: {
query: true,
param: true,
body: true,
},
},
},
},
input: {
target: 'http://localhost:4000/api.json',
validation: true,
filters: {
tags: [/^(?!app).+/],
},
},
},
})
Can you just ignore these files in your lint setup? They are generated code so they really don't need to be linted do they?
Can you just ignore these files in your lint setup? They are generated code so they really don't need to be linted do they?
Actually, the main problem is performance issues, files are so big
Understood