Linter rulesGraphQLoperation-known-types

operation-known-types

Since 0.9.0

This rule checks that the types of variables and the type conditions of fragments are types of the schema.

Rule Details

Unknown types are rejected by the server.

Configuration

This rule has no options.

version: "1.0"
commands:
  lint:
    graphql:
      rules:
        operation-known-types: warning

The rule can be disabled for a node and everything nested in it with an # apigenie-lint-disable operation-known-types 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 operations and fragments.

Examples

Good.

query Users($kind: Kind) { users(kind: $kind) { id } }

Bad. The linter reports Unknown type "UserKind"..

query Users($kind: UserKind) { users(kind: $kind) { id } }

Compatibility

The rule checks operations against the schema files named by the schema property of the configuration, or against the type system of their own document. It reports nothing without a schema.