Linter rulesGraphQLno-deprecated-required-argument
no-deprecated-required-argument
Since 0.9.0
This rule checks that required arguments and input fields are not deprecated.
Rule Details
Clients cannot stop sending a required argument (non-null and without a default value), so deprecating it has no effect; the specification forbids it. Make the argument optional, or give it a default value, before deprecating it.
Configuration
This rule has no options.
version: "1.0"
commands:
lint:
graphql:
rules:
no-deprecated-required-argument: warning
The rule can be disabled for a node and everything nested in it with an # apigenie-lint-disable no-deprecated-required-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.
type Query {
users(limit: Int = 10 @deprecated(reason: "Use `first`.")): [User]
}
Bad. The linter reports Required argument 'Query.users(limit:)' cannot be deprecated; make it optional or give it a default value first.
type Query {
users(limit: Int! @deprecated(reason: "Use `first`.")): [User]
}