require-field-of-type-query-in-mutation-result
- Category:
Schema
- Rule name:
@graphql-eslint/require-field-of-type-query-in-mutation-result
- Requires GraphQL Schema:
true
âšī¸ - Requires GraphQL Operations:
false
âšī¸
Allow the client in one round-trip not only to call mutation but also to get a wagon of data to update their application.
Currently, no errors are reported for result type
union
,interface
andscalar
.
Usage Examples
Incorrect
# eslint @graphql-eslint/require-field-of-type-query-in-mutation-result: 'error'
type User { ... }
type Mutation {
createUser: User!
}
Correct
# eslint @graphql-eslint/require-field-of-type-query-in-mutation-result: 'error'
type User { ... }
type Query { ... }
type CreateUserPayload {
user: User!
query: Query!
}
type Mutation {
createUser: CreateUserPayload!
}