# deprecation-reason-defined

Source: https://apigenie.pl/docs/linter/graphql/rules/deprecation-reason-defined

This rule checks that `@deprecated` directives have a reason.

## Rule Details

The reason is the only place where a schema tells its clients what to use instead of a deprecated field, argument or enum value. A missing or blank `reason` is reported.

## Configuration

This rule has no options.

```yaml
version: "1.0"
commands:
  lint:
    graphql:
      rules:
        deprecation-reason-defined: warning
```

The rule can be disabled for a node and everything nested in it with an `# apigenie-lint-disable deprecation-reason-defined` 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 User {
  login: String @deprecated(reason: "Use `name`.")
}
```

**Bad**. The linter reports `The deprecation of field 'User.login' should have a reason`.

```graphql
type User {
  login: String @deprecated
}
```
