Operation Name Uniqueness
Formal Specification
- For each operation definition operation in the document
- Let operationName be the name of operation .
- If
operationName
exists
- Let operations be all operation definitions in the document named operationName .
- operations must be a set of one.
Explanatory Text
Each named operation definition must be unique within a document when referred to by its name.
For example the following document is valid:
query getDogName {
dog {
name
}
}
query getOwnerName {
dog {
owner {
name
}
}
}
While this document is invalid:
query getName {
dog {
name
}
}
query getName {
dog {
owner {
name
}
}
}
It is invalid even if the type of each operation is different:
query dogOperation {
dog {
name
}
}
mutation dogOperation {
mutateDog {
id
}
}