deprecation-reason-defined
Since 0.9.0 · In the rulesets: Recommended at warning, Strict at error, All at error
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.
The rule applies to definitions. An # apigenie-lint-disable deprecation-reason-defined 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 User {
login: String @deprecated(reason: "Use `name`.")
}
Bad. The linter reports The deprecation of field 'User.login' should have a reason.
type User {
login: String @deprecated
}
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:
deprecation-reason-defined: off