Skip to content

Commit 12b3a1e

Browse files
committed
Add spec text for KnownOperationType
see: graphql/graphql-js#3592
1 parent 7908822 commit 12b3a1e

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

spec/Section 5 -- Validation.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,39 @@ extend type Dog {
129129

130130
## Operations
131131

132+
### Operation Types
133+
134+
**Formal Specification**
135+
136+
- For each {operation} in the document.
137+
- Let {operationType} be the type of {operation}
138+
- Let {operationRootType} be the root type in {schema} for {operationType}.
139+
- {operationRootType} must exist.
140+
141+
**Explanatory Text**
142+
143+
The root type for a given operation must be defined within the schema.
144+
145+
For example the following document is valid:
146+
147+
```graphql example
148+
query getDogName {
149+
dog {
150+
name
151+
}
152+
}
153+
```
154+
155+
While the following document is invalid:
156+
157+
```graphql counter-example
158+
mutation getDogName {
159+
dog {
160+
name
161+
}
162+
}
163+
```
164+
132165
### Named Operation Definitions
133166

134167
#### Operation Name Uniqueness

0 commit comments

Comments
 (0)