Linter rulesGraphQLrequired-arguments-provided

required-arguments-provided

Since 0.9.0

This rule checks that the required arguments of fields and directives are given.

Rule Details

Arguments that are non-null and without default value are required; the server rejects operations that omit them.

Configuration

This rule has no options.

version: "1.0"
commands:
  lint:
    graphql:
      rules:
        required-arguments-provided: warning

The rule can be disabled for a node and everything nested in it with an # apigenie-lint-disable required-arguments-provided 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 Field "user" argument "id" of type "ID!" is required, but it was not provided..

query User { user { 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.