-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: generated zod schemas fail to compile when outputting to a custo…
…m dir Fixes #1610
- Loading branch information
Showing
3 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { loadSchema } from '@zenstackhq/testtools'; | ||
describe('issue 1610', () => { | ||
it('regular prisma client', async () => { | ||
await loadSchema( | ||
` | ||
model User { | ||
id Int @id | ||
posts Post[] | ||
} | ||
model Post { | ||
id Int @id | ||
author User @relation(fields: [authorId], references: [id]) | ||
authorId Int | ||
} | ||
`, | ||
{ fullZod: true, output: './lib/zen' } | ||
); | ||
}); | ||
|
||
it('logical prisma client', async () => { | ||
await loadSchema( | ||
` | ||
model User { | ||
id Int @id | ||
posts Post[] | ||
} | ||
model Post { | ||
id Int @id | ||
author User @relation(fields: [authorId], references: [id]) | ||
authorId Int @default(auth().id) | ||
} | ||
`, | ||
{ fullZod: true, output: './lib/zen' } | ||
); | ||
}); | ||
|
||
it('no custom output', async () => { | ||
await loadSchema( | ||
` | ||
model User { | ||
id Int @id | ||
posts Post[] | ||
} | ||
model Post { | ||
id Int @id | ||
author User @relation(fields: [authorId], references: [id]) | ||
authorId Int @default(auth().id) | ||
} | ||
`, | ||
{ fullZod: true, preserveTsFiles: true } | ||
); | ||
}); | ||
}); |