mutation-input-argument
Since 0.9.0 · In the rulesets: Strict at error, All at error
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.
The rule applies to definitions. An # apigenie-lint-disable mutation-input-argument 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 is an object with the properties:
argumentName: the name of the argument,inputby defaultrequireNonNull: whether the argument must be non-null,trueby default
version: "1.0"
commands:
lint:
graphql:
rules:
mutation-input-argument: [error, { argumentName: data, requireNonNull: false }]
Examples
Good.
type Mutation { createUser(input: CreateUserInput!): CreateUserPayload }
input CreateUserInput { name: String }
Bad. The linter reports Field 'Mutation.createUser' should take a single argument named 'input'.
type Mutation { createUser(name: String, email: String): CreateUserPayload }
Turn it off or change its severity
In apigenie.yaml, off turns the rule off and warning or error sets its severity; a rule with options takes the severity and the options as a pair, [warning, options]. lint.graphql has the details.
commands:
lint:
graphql:
rules:
mutation-input-argument: off