# operation-name-defined

Source: https://apigenie.pl/docs/linter/graphql/rules/operation-name-defined

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.

```yaml
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**.

```graphql
query Me { me { id } }
```

**Bad**. The linter reports `The query should have a name`.

```graphql
{ me { id } }
```
