tRPC Optimized
zod-generator.config.json
{
"mode": "custom",
"output": "./generated/zod",
"globalExclusions": {
"input": ["id", "createdAt", "updatedAt"],
"result": [],
"pure": ["password", "hashedPassword"]
},
"variants": {
"pure": { "enabled": true, "suffix": ".model" },
"input": { "enabled": true, "suffix": ".input" },
"result": { "enabled": true, "suffix": ".output" }
}
}
Aligns with typical request/response patterns + internal model snapshot.
How far globalExclusions.input reaches
globalExclusions.input is not limited to the .input variant files. It applies to every CRUD input object whose name contains Create, Update or Where, because all of those resolve to the input variant. Two exemptions keep the generated types compatible with Prisma's own:
WhereUniqueInputschemas always keep every field.- Base Create input objects (
UserCreateInput,UserUncheckedCreateInput,UserCreateManyInput,UserCreateWithoutPostsInput, and the nested/connect-or-create variations) keep every field whilestrictCreateInputsstays at its default oftrue.
WhereInput and UpdateInput are not exempt. With the config above:
UserWhereInputlosesid,createdAtandupdatedAt, so you can no longer filter — ordeleteMany/updateMany— by those fields.UserUpdateInputloses them too, which is usually what you want forupdatedAtbut rarely forid.
If you only want to trim the generated variant files and leave the CRUD input objects alone, use variants.input.excludeFields instead — that list is applied when emitting variant files and is never consulted by the CRUD object generator:
zod-generator.config.json
{
"variants": {
"input": { "enabled": true, "suffix": ".input", "excludeFields": ["id", "createdAt", "updatedAt"] }
}
}