Skip to content
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

@core/zod and Prisma preview features #337

Closed
keanugrieves opened this issue Apr 10, 2023 · 1 comment
Closed

@core/zod and Prisma preview features #337

keanugrieves opened this issue Apr 10, 2023 · 1 comment

Comments

@keanugrieves
Copy link

keanugrieves commented Apr 10, 2023

Description and expected behavior
These are also unaddressed issues in the underlying libraries:

fullTextSearch

fullTextSearch

In the first screenshot, Company.schema.ts should import CompanyOrderByWithRelationAndSearchRelevanceInputObjectSchema from ./objects/CompanyOrderByWithRelationAndSearchRelevanceInput.schema.

The error might stem from these lines:

if (findFirst) {
imports.push(
`import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`,
`import { ${modelName}OrderByWithRelationInputObjectSchema } from './objects/${modelName}OrderByWithRelationInput.schema'`,
`import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`,
`import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`
);
codeBody += `findFirst: z.object({ ${selectZodSchemaLineLazy} ${includeZodSchemaLineLazy} where: ${modelName}WhereInputObjectSchema.optional(), orderBy: z.union([${modelName}OrderByWithRelationInputObjectSchema, ${modelName}OrderByWithRelationInputObjectSchema.array()]).optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.array(${modelName}ScalarFieldEnumSchema).optional() }),`;
}
if (findMany) {
imports.push(
`import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`,
`import { ${modelName}OrderByWithRelationInputObjectSchema } from './objects/${modelName}OrderByWithRelationInput.schema'`,
`import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`,
`import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`
);
codeBody += `findMany: z.object({ ${selectZodSchemaLineLazy} ${includeZodSchemaLineLazy} where: ${modelName}WhereInputObjectSchema.optional(), orderBy: z.union([${modelName}OrderByWithRelationInputObjectSchema, ${modelName}OrderByWithRelationInputObjectSchema.array()]).optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.array(${modelName}ScalarFieldEnumSchema).optional() }),`;
}

fieldReference

fieldReference

This schema isn't generated at all, although there's an unmerged pull request that might provide some clues: Brettm12345/prisma-zod-generator@8b1d50b

Environment (please complete the following information):

  • ZenStack version: 1.0.0-alpha.98
  • Prisma version: 4.12.0
  • Database type: Postgres

Additional context
Add any other context about the problem here.

@ymc9
Copy link
Member

ymc9 commented Apr 10, 2023

Thanks for filing this @keanugrieves ! Yes, there're still several unresolved issues related to Prisma preview features. We should probably allocate the next iteration to focus on fixing them.

@ymc9 ymc9 added bug labels Apr 10, 2023
@ymc9 ymc9 removed the prisma-parity label Jul 5, 2023
@ymc9 ymc9 added v1 and removed next-release labels Jul 19, 2023
@ymc9 ymc9 closed this as completed Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants