MichalLytek / MichalLytek/typegraphql-prisma
Better input type for unique queries
- Dominant language
- TypeScript
- Stars
- 918
- Forks
- 130
- PR merge metrics
- No merged PRs in 30d
Description
Suppose I have the following model:
```prisma
model User {
discord_id BigInt @id
steam_id BigInt?
profile_private Boolean? @default(true)
}
```
The generated graphql input query to find a unique user is of type:
```gql
input UserWhereUniqueInput {
discord_id: BigInt
}
```
This allows the user to pass a query like:
```gql
query {
user(where: {}) {
discord_id
}
}
```
Executing the above query throws an internal server error as expected.
**Solution:**
The generated input type should mark the `discord_id` field as non-nullable.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at generation of UserWhereUniqueInput from the Prisma User model, then trace how unique fields are rendered in the GraphQL schema. Done means discord_id is non-nullable in the generated input and an empty where object is rejected; inspect the project's generated-input coverage if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100