Linter rulesGraphQLknown-argument-names

known-argument-names

Since 0.9.0

This rule checks that the arguments given to fields and directives are defined by them.

Rule Details

Unknown arguments are rejected by the server. The arguments of @skip, @include and of the directives of the schema are checked.

Configuration

This rule has no options.

version: "1.0"
commands:
  lint:
    graphql:
      rules:
        known-argument-names: warning

The rule can be disabled for a node and everything nested in it with an # apigenie-lint-disable known-argument-names 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 User { user(id: 1) { id } }

Bad. The linter reports Unknown argument "userId" on field "Query.user"..

query User { user(userId: 1) { 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.