Skip to content

Generated zod schemas fail to compile when setting output to a custom dir #1610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ymc9 opened this issue Jul 23, 2024 · 0 comments
Closed
Milestone

Comments

@ymc9
Copy link
Member

ymc9 commented Jul 23, 2024

This happens when the ZModel triggers generation of a logical prisma client.

model User {
    id Int @id
    posts Post[]
}

model Post {
    id Int @id
    author User @relation(fields: [authorId], references: [id])
    authorId Int @default(auth().id)
}
npx zenstack generate --schema=./src/schema.zmodel --output=./src/lib/generated --no-compile
Error compiling generated code:
lib/generated/zod/input/AmortizationScheduleInput.schema.ts:4:29 - error TS2307: Cannot find module '.zenstack/models' or its corresponding type declarations.

4 import type { Prisma } from '.zenstack/models';
                              ~~~~~~
lib/generated/zod/input/AmortizationScheduleItemInput.schema.ts:4:29 - error TS2307: Cannot find module '.zenstack/models' or its corresponding type declarations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant