hasura / hasura/graphql-engine
Mutation responses should be required
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: v2.16.1
### Environment
Cloud and OSS
### What is the current behaviour?
Generated mutations have non-required output types.
For example:

### What is the expected behaviour?
I would expect instead to have:
```graphql
insert_users(objects: [users_insert_input!]!on_conflict: users_on_conflict): users_mutation_response!
```
Indeed, [the documentation ](https://hasura.io/docs/latest/api-reference/graphql-api/mutation/#insert-upsert-syntax) specifies that mutation responses are required:

This might not seem important but when doing Typescript codegen, we end up with nullable response types which is a bit annoying.
### How to reproduce the issue?
1. check the Docs explorer of Hasura with any generated mutations
### Keywords
mutation response output types required non-nullable
Contributor guide
Research direction
Start in the Hasura Docs explorer with a generated mutation and compare its output type with the documented insert/upsert syntax. Trace the schema generation path that defines mutation response nullability, then verify that generated mutation responses are non-nullable and that TypeScript codegen no longer produces nullable response types.
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
- 45/100