Linter rulesGraphQLoneof-fields-nullable
oneof-fields-nullable
Since 0.9.0
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.
Configuration
This rule has no options.
version: "1.0"
commands:
lint:
graphql:
rules:
oneof-fields-nullable: warning
The rule can be disabled for a node and everything nested in it with an # apigenie-lint-disable oneof-fields-nullable 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.
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 }