From 12b3a1ed7ff2f90ef1f1cb78b49c48b4bfccf4b1 Mon Sep 17 00:00:00 2001 From: Yaacov Rydzinski Date: Fri, 20 May 2022 09:21:24 +0300 Subject: [PATCH 1/2] Add spec text for KnownOperationType see: https://github.com/graphql/graphql-js/issues/3592 --- spec/Section 5 -- Validation.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 4eda8e7b4..27f8b96ad 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -129,6 +129,39 @@ extend type Dog { ## Operations +### Operation Types + +**Formal Specification** + +- For each {operation} in the document. +- Let {operationType} be the type of {operation} +- Let {operationRootType} be the root type in {schema} for {operationType}. +- {operationRootType} must exist. + +**Explanatory Text** + +The root type for a given operation must be defined within the schema. + +For example the following document is valid: + +```graphql example +query getDogName { + dog { + name + } +} +``` + +While the following document is invalid: + +```graphql counter-example +mutation getDogName { + dog { + name + } +} +``` + ### Named Operation Definitions #### Operation Name Uniqueness From f08bcf412172901caeba12cf5e386a2d6022a433 Mon Sep 17 00:00:00 2001 From: Yaacov Rydzinski Date: Fri, 20 May 2022 09:34:28 +0300 Subject: [PATCH 2/2] narrow section heading --- spec/Section 5 -- Validation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 27f8b96ad..f18ee7e98 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -129,7 +129,7 @@ extend type Dog { ## Operations -### Operation Types +### Operation Type Existence **Formal Specification**