oneof-fields-nullable
Since 0.9.0 · In the rulesets: Recommended at error, Strict at error, All at error
This rule checks that the fields of @oneOf input object types are nullable and have no default value.
Rule details
Exactly one field of a @oneOf input object is given; a non-null field or a default value would make every value invalid, as the specification of @oneOf requires.
The rule applies to definitions. An # apigenie-lint-disable oneof-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.
input UserBy @oneOf { id: ID, email: String }
Bad. The linter reports Input field 'UserBy.id' of the @oneOf input object type should be nullable.
input UserBy @oneOf { id: ID!, email: String }
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:
oneof-fields-nullable: off