Linter rulesGraphQLinput-no-circular-non-null

input-no-circular-non-null

Since 0.9.0

This rule checks that input object types don’t reference themselves through non-null fields.

Rule Details

No value can satisfy an input object type that requires itself, directly or through other input types, through non-null fields; the specification forbids it. Nullable and list fields break the cycle.

Configuration

This rule has no options.

version: "1.0"
commands:
  lint:
    graphql:
      rules:
        input-no-circular-non-null: warning

The rule can be disabled for a node and everything nested in it with an # apigenie-lint-disable input-no-circular-non-null 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 Filter { and: [Filter!], not: Filter }

Bad. The linter reports Cannot reference Input Object "Filter" within itself through a series of non-null fields: "not"..

input Filter { not: Filter! }

Further reading