-
-
Notifications
You must be signed in to change notification settings - Fork 127
Closed
Description
Description and expected behavior
Given the following schema:
enum FooType {
Bar
Baz
}
model User {
id String @id @default(cuid())
userFolders UserFolder[]
}
model Foo {
id String @id @default(cuid())
type FooType
userFolders UserFolder[]
@@delegate(type)
}
model Bar extends Foo {
name String
}
model Baz extends Foo {
age Int
}
model UserFolder {
id String @id @default(cuid())
userId String
fooId String
path String
user User @relation(fields: [userId], references: [id])
foo Foo @relation(fields: [fooId], references: [id])
@@unique([userId, fooId])
}
An invalid Zod schema is generated for UserFolderWhereUniqueInputObjectSchema
This schema attempts to import CompoundUniqueInput schemas for userId_delegate_aux_UserFolder_fooId_Bar/Baz, but these are removed during schema generation, causing a runtime error when these schemas are used.
Screenshots
Environment (please complete the following information):
- ZenStack version: 12.2.1
- Prisma version: 6.4.1
- Database type: Postgresql
Additional context
The bug seems to be within the zod schema generator, where .startsWith(DELEGATE_AUX_RELATION_PREFIX) is still used instead of .includes(DELEGATE_AUX_RELATION_PREFIX) to filter delegate fields on an object. The CompoundUniqueInput schemas are filtered out correctly.
ymc9
Metadata
Metadata
Assignees
Labels
No labels