[BUG] There are some errors in the generated schema file.
Describe the bug
schema.prisma
generator zod {
provider = "zod-prisma-types"
output = "zod"
prismaClientPath = "../../client"
createModelTypes = false
addIncludeType = false
addSelectType = false
validateWhereUniqueInput = false
useDefaultValidators = false
createRelationValuesTypes = false
coerceDate = false
useMultipleFiles = true
}
model Block {
id String @id @default(uuid(7)) @db.Uuid
screen String
styles String @default("{}")
traits String @default("{}")
widgetId String @db.Uuid
widget Widget @relation(fields: [widgetId], references: [id])
uiProjectId String @db.Uuid
uiProject UiProject @relation(fields: [uiProjectId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
generated BlockArgsSchema.ts
import { z } from 'zod';
import type { Prisma } from '../../client';
import { BlockSelectSchema } from '../inputTypeSchemas/BlockSelectSchema';
import { BlockIncludeSchema } from '../inputTypeSchemas/BlockIncludeSchema';
export const BlockArgsSchema: z.object({. <-- something wrong.
select: z.lazy(() => BlockSelectSchema).optional(),
include: z.lazy(() => BlockIncludeSchema).optional(),
}).strict();
export default BlockArgsSchema;
expected
export const BlockArgsSchema:z.ZodType<Prisma.???> = z.object({
Package versions (please complete the following information):
- zod: "^3.23.8"
- prisma: "^6.0.0"
I am experiencing the same.
'z.object' refers to a value, but is being used as a type here. Did you mean 'typeof z.object'?
Property 'strict' does not exist on type '{ select: ZodOptional<ZodLazy<ZodType<Prisma.ServiceSelect, ZodTypeDef, Prisma.ServiceSelect>>>; include: ZodOptional<ZodLazy<ZodType<Prisma.ServiceInclude, ZodTypeDef, Prisma.ServiceInclude>>>; }'
As well as
Namespace '"node_modules/.prisma/client/default".Prisma' has no exported member 'ServiceInclude'
// SERVICE
//------------------------------------------------------
export const ServiceIncludeSchema: z.ZodType<Prisma.ServiceInclude> = z.object({
providers: z.union([z.boolean(),z.lazy(() => ProviderServiceFindManyArgsSchema)]).optional(),
patients: z.union([z.boolean(),z.lazy(() => PatientServiceFindManyArgsSchema)]).optional(),
_count: z.union([z.boolean(),z.lazy(() => ServiceCountOutputTypeArgsSchema)]).optional(),
}).strict()
export const ServiceArgsSchema: z.object({
select: z.lazy(() => ServiceSelectSchema).optional(),
include: z.lazy(() => ServiceIncludeSchema).optional(),
}).strict();
Same versions as OP.
Same bug
In this code:
This bug occurs because PrismaClient version 6.0.0 is treated the same as PrismaClient version 5.0.x or earlier.
Prisma 6 is not yet supported, see #usage:
Supports prisma 4.x - 5.x
Revert to 5.x until next release and the package should function fine. Readme should be updated to make the versioning issue a bit more obvious though, made a PR here: #301
The issue should be gone in the latest version. As @FranzaLeny pointed out the conditional did not account for version 6.x.x of prisma. This is now fixed.
Regarding the missing ServiceInclude type I could not reproduce the issue. @jacobbrunson please let me know if it works on your end with the latest version.
same issue
'z.object' refers to a value, but is being used as a type here. Did you mean 'typeof z.object'?ts(2749)