Skip to content

unique-operation-name

GraphQLcorrectnessno fixdefault: error

Reports two operations of a document with the same name, within one file.

A server cannot tell which operation a request with that name runs, and tools that key on the name (caches, persisted queries, generated code) collide.

To fix, rename one of them.

Reported
query A { a }
query A { b }
query B { c }
fragment F on T { a }
...
graphql:
lint:
rules:
unique-operation-name: error # off, warn, error (default)

Suppress one line with sudsy-disable-next-line unique-operation-name in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
graphql-eslint unique-operation-name partial Not checked across files.