# mutation-payload-suffix

Source: https://api-genie.dev/docs/linter/graphql/rules/mutation-payload-suffix

A rule of the GraphQL linter, which reads GraphQL schemas and operations. Since 0.9.0. In the rulesets: Strict at error, All at error.

This rule checks that the result types of mutation fields end with a suffix, `Payload` by default.

## Rule details

Payload types are specific to their mutation; the suffix tells them from the domain types they contain. Scalar and enum results are not reported (see `no-scalar-result-on-mutation`).

The rule applies to definitions. An `# apigenie-lint-disable mutation-payload-suffix` comment on a
node turns it off for the node and everything nested in it; at the top of the file, separated from
the first definition by a blank line, the comment turns it off for the whole file.

## Configuration

The configuration block can be a string, the suffix, or an object with the `suffix`
property.

```yaml
version: "1.0"
commands:
  lint:
    graphql:
      rules:
        mutation-payload-suffix: [error, Result]
```

## Examples

**Good**.

```graphql
type Mutation { createUser(input: CreateUserInput!): CreateUserPayload }
```

**Bad**. The linter reports `The result type 'User' of field 'Mutation.createUser' should end with 'Payload'`.

```graphql
type Mutation { createUser(input: CreateUserInput!): User }
```
