# no-deprecated-required-argument

Source: https://api-genie.dev/docs/linter/graphql/rules/no-deprecated-required-argument

A rule of the GraphQL linter, which reads GraphQL schemas and operations. 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**.

```graphql
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`.

```graphql
type Query {
  users(limit: Int! @deprecated(reason: "Use `first`.")): [User]
}
```
