Linter rulesGraphQLoperation-name-defined
operation-name-defined
Since 0.9.0
This rule checks that operations have names.
Rule Details
Names identify operations in server logs, metrics, persisted queries and developer tools.
Configuration
This rule has no options.
version: "1.0"
commands:
lint:
graphql:
rules:
operation-name-defined: warning
The rule can be disabled for a node and everything nested in it with an # apigenie-lint-disable operation-name-defined 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 Me { me { id } }
Bad. The linter reports The query should have a name.
{ me { id } }