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

optional fields in schema produce inconsistent orderBy types between required and optional scalar fields #209

Open
scarrico-divergent opened this issue Mar 8, 2024 · 1 comment

Comments

@scarrico-divergent
Copy link

After upgrading to v19 (to align with Prisma 5), we are experiencing issues with our existing graphql queries and query generation.

Our generated types have changed, specifically in the xxxOrderByWithRelationInput interfaces.

For example:

jiraData?: keyof typeof SortOrder;
jiraStatus?: InstanceType<typeof SortOrderInput>;

Previously we were on v18.0.2, which produced a class more like the below.

jiraData?: keyof typeof SortOrder;
jiraStatus?: keyof typeof SortOrder;

The required GQL query for sorting on jiraStatus is now orderBy: { jiraStatus: {sort: 'asc' }} instead of orderBy: {jiraStatus: 'asc'}}. This apepars to be in service of Prisma 4.16+ nullable sort feature https://www.prisma.io/docs/orm/prisma-client/queries/filtering-and-sorting#sort-with-null-records-first-or-last

However, Prisma appears to support either <field>: 'asc' or <field>: {sort: 'asc'} which this generated type does not. Can the type be relaxed to support either syntax if null sorting is not desired? It is difficult from the graphql query generation side to determine which fields to apply which syntax to.

@npv2k1
Copy link

npv2k1 commented Aug 16, 2024

Same issue

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