# mutation-input-argument

Source: https://apigenie.pl/docs/linter/graphql/rules/mutation-input-argument

This rule checks that mutation fields take a single argument, `input`, of a non-null input object type.

## Rule Details

A single input object can evolve without breaking clients: fields are added to the input type rather than as new arguments of the mutation. Mutations without arguments are not reported.

## Configuration

The configuration block is an object with the properties:

- `argumentName`: the name of the argument, `input` by default
- `requireNonNull`: whether the argument must be non-null, `true` by default

```yaml
version: "1.0"
commands:
  lint:
    graphql:
      rules:
        mutation-input-argument: [error, { argumentName: data, requireNonNull: false }]
```

The rule can be disabled for a node and everything nested in it with an `# apigenie-lint-disable mutation-input-argument` comment on the node, or for a whole file with the comment at the top of the file, separated from the first definition by a blank line. It applies to definitions.

## Examples

**Good**.

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

**Bad**. The linter reports `Field 'Mutation.createUser' should take a single argument named 'input'`.

```graphql
type Mutation { createUser(name: String, email: String): CreateUserPayload }
```
