deprecation-date-defined
Since 0.9.0 · In the rulesets: All at error
This rule checks that @deprecated directives have a deletion date that has not passed.
Rule details
A deletion date tells clients how long a deprecated element will stay, and reminds the schema authors to remove it. The date is an argument of @deprecated, deletionDate by default, in the format YYYY-MM-DD. A missing or invalid date, or a date in the past, is reported. The argument has to be added to the definition of @deprecated that the server uses.
The rule applies to definitions. An # apigenie-lint-disable deprecation-date-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.
Configuration
The configuration block is an object with the properties:
argumentName: the argument with the date,deletionDateby defaulttoday: the current date asYYYY-MM-DD, for reproducible runs; the date of the run by default
version: "1.0"
commands:
lint:
graphql:
rules:
deprecation-date-defined: [warning, { argumentName: removeAfter }]
Examples
Good.
type User {
login: String @deprecated(reason: "Use `name`.", deletionDate: "2099-01-01")
}
Bad. The linter reports The deprecation of field 'User.login' should have a deletion date ('deletionDate' argument).
type User {
login: String @deprecated(reason: "Use `name`.")
}
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-date-defined: off