root-fields-nullable
Since 0.9.0 · In the rulesets: Strict at error, All at error
This rule checks that the fields of the query and mutation root types are nullable.
Rule details
An error in a non-null field nulls its parent; for a root field, the parent is the whole data of the response. Nullable root fields keep the other fields of a response when one of them fails.
The rule applies to definitions. An # apigenie-lint-disable root-fields-nullable 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 { user(id: ID!): User }
Bad. The linter reports Field 'Query.user' of the query root type should be nullable, not 'User!'.
type Query { user(id: ID!): 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:
root-fields-nullable: off