-
Notifications
You must be signed in to change notification settings - Fork 2
Simplify the spec to only include the ! nullability designator #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: clientControlledNullability
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -564,39 +564,26 @@ Each field requested in the grouped field set that is defined on the selected | |
objectType will result in an entry in the response map. Field execution first | ||
coerces any provided argument values, then resolves a value for the field, and | ||
finally completes that value either by recursively executing another selection | ||
set or coercing a scalar value. `ccnPropagationPairs` is an unordered map where | ||
the keys are paths of required fields, and values are paths of the nearest | ||
optional parent to those required fields. `currentPropagationPath` starts as an | ||
empty path to indicate that `null` propagation should continue until it hits | ||
`data` if there is no optional field. | ||
set or coercing a scalar value. | ||
|
||
ExecuteField(objectType, objectValue, fieldType, fields, variableValues, | ||
currentPropagationPath, ccnPropagationPairs): | ||
ExecuteField(objectType, objectValue, fieldType, fields, variableValues): | ||
|
||
- Let {field} be the first entry in {fields}. | ||
- Let {fieldName} be the field name of {field}. | ||
- Let {requiredStatus} be the required status of {field}. | ||
- Let {newPropagationPath} be {path} if {requiredStatus} is optional, otherwise | ||
let {newPropagationPath} be {currentPropagationPath} | ||
- If {requiredStatus} is optional: | ||
- Let {newPropagationPath} be {path} | ||
- If {requiredStatus} is required: | ||
- Set {path} to {newPropagationPath} in {ccnPropagationPairs} | ||
- Let {argumentValues} be the result of {CoerceArgumentValues(objectType, field, | ||
variableValues)} | ||
- Let {resolvedValue} be {ResolveFieldValue(objectType, objectValue, fieldName, | ||
argumentValues)}. | ||
- Let {modifiedFieldType} be {ApplyRequiredStatus(fieldType, requiredStatus)}. | ||
- Return the result of {CompleteValue(modifiedFieldType, fields, resolvedValue, | ||
variableValues, newPropagationPath, ccnPropagationPairs)}. | ||
- Return the result of {CompleteValue(fieldType, fields, resolvedValue, | ||
variableValues)}. | ||
|
||
## Accounting For Client Controlled Nullability Designators | ||
|
||
A field can have its nullability status set either in its service's schema, or a | ||
nullability designator (`!` or `?`) can override it for the duration of an | ||
execution. In order to determine a field's true nullability, both are taken into | ||
account and a final type is produced. A field marked with a `!` is called a | ||
"required field" and a field marked with a `?` is called an optional field. | ||
nullability designator (`!`) can override it for the duration of an execution. | ||
In order to determine a field's true nullability, both are taken into account | ||
and a final type is produced. A field marked with a `!` is called a "required | ||
field". | ||
|
||
ApplyRequiredStatus(type, requiredStatus): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I got rid of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed |
||
|
||
|
@@ -605,8 +592,6 @@ ApplyRequiredStatus(type, requiredStatus): | |
- If {requiredStatus} is not a list: | ||
- If {requiredStatus} is required: | ||
- return a `Non-Null` version of {type} | ||
- If {requiredStatus} is optional: | ||
- return a nullable version of {type} | ||
- Create a {stack} initially containing {type}. | ||
- As long as the top of {stack} is a list: | ||
- Let {currentType} be the top item of {stack}. | ||
|
@@ -623,13 +608,6 @@ ApplyRequiredStatus(type, requiredStatus): | |
- Let {nullableType} be the nullable type of {nextType}. | ||
- Set {resultingType} to the Non-Nullable type of {nullableType}. | ||
- Continue onto the next node. | ||
- For each {node} that is a OptionalDesignator: | ||
- If {resultingType} exists: | ||
- Set {resultingType} to the nullableType type of {resultingType}. | ||
- Continue onto the next node. | ||
- Pop the top of {stack} and let {nextType} be the result. | ||
- Set {resultingType} to the nullable type of {resultingType} | ||
- Continue onto the next node. | ||
- For each {node} that is a ListNullabilityDesignator: | ||
- Pop the top of {stack} and let {listType} be the result | ||
- If the nullable type of {listType} is not a list | ||
|
@@ -645,9 +623,6 @@ ApplyRequiredStatus(type, requiredStatus): | |
- Set {resultingType} to a list where the element is {resultingType}. | ||
- Continue onto the next node. | ||
- Set {resultingType} to {listType} | ||
- If {stack} is not empty: | ||
- Raise a field error because {requiredStatus} had fewer list dimensions than | ||
{outputType} and is invalid. | ||
- Return {resultingType}. | ||
|
||
### Coercing Field Arguments | ||
|
@@ -866,9 +841,6 @@ handled by the parent field. If the parent field may be {null} then it resolves | |
to {null}, otherwise if it is a `Non-Null` type, the field error is further | ||
propagated to its parent field. | ||
|
||
If a required field resolves to {null}, propagation instead happens until an | ||
optional field is found. | ||
|
||
If a `List` type wraps a `Non-Null` type, and one of the elements of that list | ||
resolves to {null}, then the entire list must resolve to {null}. If the `List` | ||
type is also wrapped in a `Non-Null`, the field error continues to propagate | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to have an example where the dimensions of the designator are less than the dimensions of the field type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some examples after this paragraph.