List types with union input types are not supported
See original GitHub issueBug description
I’m submitting this as a bug report since I can’t find anything in the docs about this limitation, I apologize in case I’m missing something.
I got this in my schema.prisma
:
enum UserRole {
ADMIN
// ...
}
model User {
roles UserRole[]
// ...
}
Since this syntax is allowed and prisma client is correctly generated I expected I could query my User
table on the roles
column with the following syntax:
import { UserRole } from '@prisma/client';
const users = await prisma.user.findMany({
where: {
roles: [UserRole.ADMIN],
},
});
But if try to do so I get the following error:
List types with union input types are not supported
Expected behavior
Since the Prisma schema parser allows the enum list syntax and the client is correctly generated I would expect this to work, or at least a note in the docs.
Environment & setup
- OS: macOS
- Database: PostgreSQL
- Node.js version: v12.13.1
- Prisma version:
@prisma/cli : 2.7.0
Current platform : darwin
Query Engine : query-engine eaade828a21d8ee3f4940f0af7da3ae0922db4df (at node_modules/@prisma/cli/query-engine-darwin)
Migration Engine : migration-engine-cli eaade828a21d8ee3f4940f0af7da3ae0922db4df (at node_modules/@prisma/cli/migration-engine-darwin)
Introspection Engine : introspection-core eaade828a21d8ee3f4940f0af7da3ae0922db4df (at node_modules/@prisma/cli/introspection-engine-darwin)
Format Binary : prisma-fmt eaade828a21d8ee3f4940f0af7da3ae0922db4df (at node_modules/@prisma/cli/prisma-fmt-darwin)
Studio : 0.287.0
Preview Features : insensitiveFilters
Anyway, congratulations and thank you for the amazing work with this project.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
List types with union input types are not supported #3691
I'm submitting this as a bug report since I can't find anything in the docs about this limitation, I apologize in case I'm...
Read more >Unions and interfaces - Apollo GraphQL Docs
Unions and interfaces are abstract GraphQL types that enable a schema field to return one of multiple object types. Union type.
Read more >GraphQL Union and Input Type? - Stack Overflow
As of September 2017, this is not possible. There is an ongoing discussion ... As Artur mentioned, support for union input types is...
Read more >Absinthe middleware for tagged union input types
At the time of writing this, union input types are not yet supported by either Absinthe or the GraphQL spec itself.
Read more >Union types in GraphQL - Dev - Discuss Dgraph
The member types of a Union type must all be Object base types; Scalar, Interface and Union types must not be member types...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, yes - I hadn’t upgraded the client. That’s now working - thanks!
Just need to wait for #3475 now, as exact equals on an array of strings is not very useful.
I’m running into the same error (List types with union input types are not supported) with the following model and query:
I tried upgrading to 2.8-dev.55 (and 2.8-dev.36), but I get the following error when generating types (
prisma generate
).And the following runtime error (although given I wasn’t able to run
prisma generate
because of the above error, it’s probably related to that).