no-deprecated-required-argument

Since 0.9.0 · In the rulesets: Recommended at error, Strict at error, All at error

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.

The rule applies to definitions. An # apigenie-lint-disable no-deprecated-required-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.

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]
}

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:
        no-deprecated-required-argument: off

Further reading

Last updated on View as Markdown
Was this helpful?