[BUG] There are some errors in the generated schema file.
Opened this issue · 5 comments
pruge commented
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"
jacobbrunson commented
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.
insky commented
Same bug
FranzaLeny commented
JackMBurch commented
chrishoermann commented
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.