From b7bf1073b7eed28de3030469ded7b04bd4443500 Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Mon, 27 May 2024 14:56:57 -0400 Subject: [PATCH 1/6] Add 5.2.4 Operation Type Configuration --- spec/Section 5 -- Validation.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 473cf5457..7dffd091d 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -332,6 +332,37 @@ contain any number of operations, each of which may contain different root fields. When executed, a document containing multiple subscription operations must provide the operation name as described in {GetOperation()}. +### 5.2.4 Operation Type Configuration + +#### Formal Specification + +For each operation definition in the document: +- Let operationType be the type of the operation (query, mutation, or subscription). +- The corresponding type for operationType must be defined in the schema. + +#### Explanatory Text + +The schema must be properly configured to handle mutation and subscription operation +types. This ensures that when a mutation or subscription operation is defined in the +document, the schema includes the appropriate type to handle these operations. + +While query operations are required for all schemas, mutation and subscription operations +are optional. If the schema does not include the necessary type for a mutation or subscription +operation defined in the document, it will be considered invalid. + +For example, the following document is valid if the schema includes a Mutation type, but +invalid if it does not: + +```graphql +mutation { + likeStory(storyID: 12345) { + story { + likeCount + } + } +} +``` + ## Fields ### Field Selections From 94e2bdab93b4c582f80bcf93f6b13bf956470a54 Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Mon, 27 May 2024 15:02:03 -0400 Subject: [PATCH 2/6] Update spec/Section 5 -- Validation.md --- 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 7dffd091d..144c5430b 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -332,7 +332,7 @@ contain any number of operations, each of which may contain different root fields. When executed, a document containing multiple subscription operations must provide the operation name as described in {GetOperation()}. -### 5.2.4 Operation Type Configuration +### Operation Type Configuration #### Formal Specification From ef77474343c137562d5578f36dd38ff7427fd9dd Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Mon, 27 May 2024 15:03:38 -0400 Subject: [PATCH 3/6] Update spec/Section 5 -- Validation.md --- spec/Section 5 -- Validation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 144c5430b..8936eb31e 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -337,8 +337,8 @@ must provide the operation name as described in {GetOperation()}. #### Formal Specification For each operation definition in the document: -- Let operationType be the type of the operation (query, mutation, or subscription). -- The corresponding type for operationType must be defined in the schema. +- Let {operationType} be the type of the operation (query, mutation, or subscription). +- The corresponding type for {operationType} must be defined in the schema. #### Explanatory Text From 0f283f9e5ef36e738bc722433c523fd42c2921db Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Mon, 27 May 2024 15:04:50 -0400 Subject: [PATCH 4/6] Update spec/Section 5 -- Validation.md --- spec/Section 5 -- Validation.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 8936eb31e..207901dd9 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -337,6 +337,7 @@ must provide the operation name as described in {GetOperation()}. #### Formal Specification For each operation definition in the document: + - Let {operationType} be the type of the operation (query, mutation, or subscription). - The corresponding type for {operationType} must be defined in the schema. From 6f187fa90f14ce86f6d6bafd6e9fa95ba5dab069 Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Tue, 4 Jun 2024 10:02:17 -0400 Subject: [PATCH 5/6] Apply suggestions from code review Co-authored-by: Benjie --- spec/Section 5 -- Validation.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 207901dd9..4f855db27 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -332,20 +332,20 @@ contain any number of operations, each of which may contain different root fields. When executed, a document containing multiple subscription operations must provide the operation name as described in {GetOperation()}. -### Operation Type Configuration +### Operation Type Exists #### Formal Specification For each operation definition in the document: -- Let {operationType} be the type of the operation (query, mutation, or subscription). -- The corresponding type for {operationType} must be defined in the schema. +- Let {operationType} be the type of the operation (`query`, `mutation`, or `subscription`). +- The corresponding _root operation type_ for {operationType} must be defined in the schema. #### Explanatory Text -The schema must be properly configured to handle mutation and subscription operation -types. This ensures that when a mutation or subscription operation is defined in the -document, the schema includes the appropriate type to handle these operations. +A schema defines the root operation types that it supports. Any document that +contains an operation of a type unsupported by the schema is invalid, since such +an operation cannot be executed. While query operations are required for all schemas, mutation and subscription operations are optional. If the schema does not include the necessary type for a mutation or subscription @@ -354,7 +354,7 @@ operation defined in the document, it will be considered invalid. For example, the following document is valid if the schema includes a Mutation type, but invalid if it does not: -```graphql +```graphql example mutation { likeStory(storyID: 12345) { story { From b9f1f3305e395bb522b85e412d0772476803f857 Mon Sep 17 00:00:00 2001 From: Shane32 Date: Fri, 4 Oct 2024 19:28:43 -0400 Subject: [PATCH 6/6] Reformat --- spec/Section 5 -- Validation.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index e53854040..c71a40931 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -338,8 +338,10 @@ must provide the operation name as described in {GetOperation()}. For each operation definition in the document: -- Let {operationType} be the type of the operation (`query`, `mutation`, or `subscription`). -- The corresponding _root operation type_ for {operationType} must be defined in the schema. +- Let {operationType} be the type of the operation (`query`, `mutation`, or + `subscription`). +- The corresponding _root operation type_ for {operationType} must be defined in + the schema. #### Explanatory Text @@ -347,12 +349,13 @@ A schema defines the root operation types that it supports. Any document that contains an operation of a type unsupported by the schema is invalid, since such an operation cannot be executed. -While query operations are required for all schemas, mutation and subscription operations -are optional. If the schema does not include the necessary type for a mutation or subscription -operation defined in the document, it will be considered invalid. +While query operations are required for all schemas, mutation and subscription +operations are optional. If the schema does not include the necessary type for a +mutation or subscription operation defined in the document, it will be +considered invalid. -For example, the following document is valid if the schema includes a Mutation type, but -invalid if it does not: +For example, the following document is valid if the schema includes a Mutation +type, but invalid if it does not: ```graphql example mutation {