Description
Description and expected behavior
Given the following model schema:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
type FooMetadata {
isLocked Boolean
}
type FooOptionMetadata {
color String
}
model Foo {
id String @id @db.Uuid @default(uuid())
meta FooMetadata @json
}
model FooOption {
id String @id @db.Uuid @default(uuid())
meta FooOptionMetadata @json
}
zenstack generate
will create an enhanced PrismaClient which incorrectly maps the type of FooOption.meta
for prisma input types to FooMetadata
instead of FooOptionMetadata
. The result payload type correctly maps meta
to FooOptionMeta
.
Screenshots


Environment (please complete the following information):
- ZenStack version: 2.11.6
- Prisma version: 6.3.1
- Database type: Postgresql
Additional context
Interestingly, renaming FooOption
/FooOptionMetadata
to Bar
/BarMetadata
seems to resolve the issue. So at first glance it seems something is breaking when the string Option
is used?
I'd be happy to spend some more time investigating this issue, but would appreciate any advice the team has.
Repo which reproduces the bug:
https://github.com/diesal11/zenstack-json-type-bug