Skip to content

Commit 3cc7af5

Browse files
committed
errors and validation formal definitions
1 parent 1954680 commit 3cc7af5

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

spec/Section 5 -- Validation.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ FieldsInSetCanMerge(set):
426426

427427
SameResponseShape(fieldA, fieldB):
428428

429+
<<<<<<< HEAD
429430
- Let {typeA} be the return type of {fieldA}.
430431
- Let {typeB} be the return type of {fieldB}.
431432
- If {typeA} or {typeB} is Non-Null.
@@ -448,6 +449,34 @@ SameResponseShape(fieldA, fieldB):
448449
- Given each pair of members {subfieldA} and {subfieldB} in {fieldsForName}:
449450
- If {SameResponseShape(subfieldA, subfieldB)} is false, return false.
450451
- Return true.
452+
=======
453+
* Let {typeA} be the return type of {fieldA}.
454+
* Let {typeB} be the return type of {fieldB}.
455+
* Let {fieldARequiredStatus} be the required status of {fieldA}
456+
* Let {fieldBRequiredStatus} be the required status of {fieldB}
457+
* Let {typeA} be the result of {ModifiedOutputType(typeA, fieldARequiredStatus)}
458+
* Let {typeB} be the result of {ModifiedOutputType(typeB, fieldBRequiredStatus)}
459+
* If {typeA} or {typeB} is Non-Null.
460+
* If {typeA} or {typeB} is nullable, return false.
461+
* Let {typeA} be the nullable type of {typeA}
462+
* Let {typeB} be the nullable type of {typeB}
463+
* If {typeA} or {typeB} is List.
464+
* If {typeA} or {typeB} is not List, return false.
465+
* Let {typeA} be the item type of {typeA}
466+
* Let {typeB} be the item type of {typeB}
467+
* Repeat from step 3.
468+
* If {typeA} or {typeB} is Scalar or Enum.
469+
* If {typeA} and {typeB} are the same type return true, otherwise return
470+
false.
471+
* Assert: {typeA} and {typeB} are both composite types.
472+
* Let {mergedSet} be the result of adding the selection set of {fieldA} and
473+
the selection set of {fieldB}.
474+
* Let {fieldsForName} be the set of selections with a given response name in
475+
{mergedSet} including visiting fragments and inline fragments.
476+
* Given each pair of members {subfieldA} and {subfieldB} in {fieldsForName}:
477+
* If {SameResponseShape(subfieldA, subfieldB)} is false, return false.
478+
* Return true.
479+
>>>>>>> 9906241 (errors and validation formal definitions)
451480
452481
**Explanatory Text**
453482

spec/Section 6 -- Execution.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,9 @@ field returned {null}, and the error must be added to the {"errors"} list in the
797797
response.
798798

799799
If the result of resolving a field is {null} (either because the function to
800-
resolve the field returned {null} or because a field error was raised), and that
801-
field is of a `Non-Null` type, then a field error is raised. The error must be
802-
added to the {"errors"} list in the response.
800+
resolve the field returned {null} or because a field error was raised), and
801+
the {ModifiedOutputType} of that field is of a `Non-Null` type, then a field
802+
error is raised. The error must be added to the {"errors"} list in the response.
803803

804804
If the field returns {null} because of a field error which has already been
805805
added to the {"errors"} list in the response, the {"errors"} list must not be
@@ -808,8 +808,8 @@ field.
808808

809809
Since `Non-Null` type fields cannot be {null}, field errors are propagated to be
810810
handled by the parent field. If the parent field may be {null} then it resolves
811-
to {null}, otherwise if it is a `Non-Null` type, the field error is further
812-
propagated to its parent field.
811+
to {null}, otherwise if its {ModifiedOutputType} is a `Non-Null` type, the field
812+
error is further propagated to its parent field.
813813

814814
If a `List` type wraps a `Non-Null` type, and one of the elements of that list
815815
resolves to {null}, then the entire list must resolve to {null}. If the `List`

0 commit comments

Comments
 (0)