@@ -568,63 +568,70 @@ set or coercing a scalar value.
568
568
569
569
ExecuteField(objectType, objectValue, fieldType, fields, variableValues):
570
570
571
- - Let {field} be the first entry in {fields}.
572
- - Let {fieldName} be the field name of {field}.
573
- - Let {requiredStatus} be the required status of {field}.
574
- - Let {argumentValues} be the result of {CoerceArgumentValues(objectType, field, variableValues)}
575
- - Let {resolvedValue} be {ResolveFieldValue(objectType, objectValue, fieldName, argumentValues)}.
576
- - Let {modifiedFieldType} be {ModifiedOutputType(fieldType, requiredStatus)}.
577
- - Return the result of {CompleteValue(modifiedFieldType, fields, resolvedValue, variableValues)}.
571
+ - Let {field} be the first entry in {fields}.
572
+ - Let {fieldName} be the field name of {field}.
573
+ - Let {requiredStatus} be the required status of {field}.
574
+ - Let {argumentValues} be the result of {CoerceArgumentValues(objectType, field,
575
+ variableValues)}
576
+ - Let {resolvedValue} be {ResolveFieldValue(objectType, objectValue, fieldName,
577
+ argumentValues)}.
578
+ - Let {modifiedFieldType} be {ModifiedOutputType(fieldType, requiredStatus)}.
579
+ - Return the result of {CompleteValue(modifiedFieldType, fields, resolvedValue,
580
+ variableValues)}.
578
581
579
582
## Accounting For Client Controlled Nullability Designators
580
583
581
- A field can have its nullability status set either in its service's schema, or
582
- a nullability designator (! or ?) can override it for the duration of an execution.
583
- In order to determine a field's true nullability, both are taken into account
584
- and a final type is produced.
584
+ A field can have its nullability status set either in its service's schema, or a
585
+ nullability designator (! or ?) can override it for the duration of an
586
+ execution. In order to determine a field's true nullability, both are taken into
587
+ account and a final type is produced.
585
588
586
589
ModifiedOutputType(outputType, requiredStatus):
587
590
588
- - Create a {stack} initially containing {type}.
589
- - As long as the top of {stack} is a list:
590
- - Let {currentType} be the top item of {stack}.
591
- - Push the {elementType} of {currentType} to the {stack}.
592
- - If {requiredStatus} exists:
593
- - Start visiting {node}s in {requiredStatus} and building up a {resultingType}:
594
- - For each {node} that is a RequiredDesignator:
595
- - If {resultingType} exists:
596
- - Let {nullableResult} be the nullable type of {resultingType}.
597
- - Set {resultingType} to the Non-Nullable type of {nullableResult}.
598
- - Continue onto the next node.
599
- - Pop the top of {stack} and let {nextType} be the result.
600
- - Let {nullableType} be the nullable type of {nextType}.
601
- - Set {resultingType} to the Non-Nullable type of {nullableType}.
591
+ - Create a {stack} initially containing {type}.
592
+ - As long as the top of {stack} is a list:
593
+ - Let {currentType} be the top item of {stack}.
594
+ - Push the {elementType} of {currentType} to the {stack}.
595
+ - If {requiredStatus} exists:
596
+ - Start visiting {node}s in {requiredStatus} and building up a
597
+ {resultingType}:
598
+ - For each {node} that is a RequiredDesignator:
599
+ - If {resultingType} exists:
600
+ - Let {nullableResult} be the nullable type of {resultingType}.
601
+ - Set {resultingType} to the Non-Nullable type of {nullableResult}.
602
602
- Continue onto the next node.
603
- - For each {node} that is a OptionalDesignator:
604
- - If {resultingType} exists:
605
- - Set {resultingType} to the nullableType type of {resultingType}.
606
- - Continue onto the next node.
607
- - Pop the top of {stack} and let {nextType} be the result.
608
- - Set {resultingType} to the nullable type of {resultingType}
603
+ - Pop the top of {stack} and let {nextType} be the result.
604
+ - Let {nullableType} be the nullable type of {nextType}.
605
+ - Set {resultingType} to the Non-Nullable type of {nullableType}.
606
+ - Continue onto the next node.
607
+ - For each {node} that is a OptionalDesignator:
608
+ - If {resultingType} exists:
609
+ - Set {resultingType} to the nullableType type of {resultingType}.
609
610
- Continue onto the next node.
610
- - For each {node} that is a ListNullabilityDesignator:
611
- - Pop the top of {stack} and let {listType} be the result
612
- - If the nullable type of {listType} is not a list
613
- - Pop the top of {stack} and set {listType} to the result
614
- - If {listType} does not exist:
615
- - Throw an error because {requiredStatus} had more list dimensions than {outputType} and is invalid.
616
- - If {resultingType} exist:
617
- - If {listType} is Non-Nullable:
618
- - Set {resultingType} to a Non-Nullable list where the element is {resultingType}.
619
- - Otherwise:
620
- - Set {resultingType} to a list where the element is {resultingType}.
621
- - Continue onto the next node.
622
- - Set {resultingType} to {listType}
623
- - If {stack} is not empty:
624
- - Throw an error because {requiredStatus} had fewer list dimensions than {outputType} and is invalid.
625
- - Return {resultingType}.
626
- - Otherwise:
627
- - Return {outputType}.
611
+ - Pop the top of {stack} and let {nextType} be the result.
612
+ - Set {resultingType} to the nullable type of {resultingType}
613
+ - Continue onto the next node.
614
+ - For each {node} that is a ListNullabilityDesignator:
615
+ - Pop the top of {stack} and let {listType} be the result
616
+ - If the nullable type of {listType} is not a list
617
+ - Pop the top of {stack} and set {listType} to the result
618
+ - If {listType} does not exist:
619
+ - Throw an error because {requiredStatus} had more list dimensions than
620
+ {outputType} and is invalid.
621
+ - If {resultingType} exist:
622
+ - If {listType} is Non-Nullable:
623
+ - Set {resultingType} to a Non-Nullable list where the element is
624
+ {resultingType}.
625
+ - Otherwise:
626
+ - Set {resultingType} to a list where the element is {resultingType}.
627
+ - Continue onto the next node.
628
+ - Set {resultingType} to {listType}
629
+ - If {stack} is not empty:
630
+ - Throw an error because {requiredStatus} had fewer list dimensions than
631
+ {outputType} and is invalid.
632
+ - Return {resultingType}.
633
+ - Otherwise:
634
+ - Return {outputType}.
628
635
629
636
### Coercing Field Arguments
630
637
@@ -827,9 +834,9 @@ field returned {null}, and the error must be added to the {"errors"} list in the
827
834
response.
828
835
829
836
If the result of resolving a field is {null} (either because the function to
830
- resolve the field returned {null} or because a field error was raised), and
831
- the {ModifiedOutputType} of that field is of a ` Non-Null ` type, then a field
832
- error is raised. The error must be added to the {"errors"} list in the response.
837
+ resolve the field returned {null} or because a field error was raised), and the
838
+ {ModifiedOutputType} of that field is of a ` Non-Null ` type, then a field error
839
+ is raised. The error must be added to the {"errors"} list in the response.
833
840
834
841
If the field returns {null} because of a field error which has already been
835
842
added to the {"errors"} list in the response, the {"errors"} list must not be
@@ -838,7 +845,7 @@ field.
838
845
839
846
Since ` Non-Null ` type fields cannot be {null}, field errors are propagated to be
840
847
handled by the parent field. If the parent field may be {null} then it resolves
841
- to {null}, otherwise if its {ModifiedOutputType} is a ` Non-Null ` type, the field
848
+ to {null}, otherwise if its {ModifiedOutputType} is a ` Non-Null ` type, the field
842
849
error is further propagated to its parent field.
843
850
844
851
If a ` List ` type wraps a ` Non-Null ` type, and one of the elements of that list
0 commit comments