Skip to content

Commit 8395fd5

Browse files
committed
Change name to 'SemanticNonNull' and syntax to bang prefix
1 parent 23fa23b commit 8395fd5

File tree

4 files changed

+72
-74
lines changed

4 files changed

+72
-74
lines changed

spec/Section 2 -- Language.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,10 +1239,10 @@ NonNullType :
12391239
- NamedType !
12401240
- ListType !
12411241

1242-
NullOnlyOnErrorType :
1242+
SemanticNonNullType :
12431243

1244-
- NamedType \*
1245-
- ListType \*
1244+
- ! NamedType
1245+
- ! ListType
12461246

12471247
GraphQL describes the types of data expected by arguments and variables. Input
12481248
types may be lists of another input type, or a non-null variant of any other

spec/Section 3 -- Type System.md

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,7 @@ non-null input type as invalid.
18591859
**Type Validation**
18601860

18611861
1. A Non-Null type must not wrap another Non-Null type.
1862-
1. A Non-Null type must not wrap a Null-Only-On-Error type.
1862+
1. A Non-Null type must not wrap a Semantic-Non-Null type.
18631863

18641864
### Combining List and Non-Null
18651865

@@ -1893,82 +1893,82 @@ Following are examples of result coercion with various types and values:
18931893
| `[Int!]!` | `[1, 2, null]` | Error: Item cannot be null |
18941894
| `[Int!]!` | `[1, 2, Error]` | Error: Error occurred in item |
18951895

1896-
## Null-Only-On-Error
1896+
## Semantic-Non-Null
18971897

1898-
The GraphQL Null-Only-On-Error type is an alternative to the GraphQL Non-Null
1898+
The GraphQL Semantic-Non-Null type is an alternative to the GraphQL Non-Null
18991899
type to disallow null unless accompanied by a field error. This type wraps an
19001900
underlying type, and this type acts identically to that wrapped type, with the
1901-
exception that {null} will result in a field error being raised. A trailing
1902-
asterisk is used to denote a field that uses a Null-Only-On-Error type like
1903-
this: `name: String*`.
1901+
exception that {null} will result in a field error being raised. A leading
1902+
exclamation mark is used to denote a field that uses a Semantic-Non-Null type
1903+
like this: `name: !String`.
19041904

1905-
Null-Only-On-Error types are only valid for use as an _output type_; they must
1905+
Semantic-Non-Null types are only valid for use as an _output type_; they must
19061906
not be used as an _input type_.
19071907

19081908
**Nullable vs. Optional**
19091909

1910-
Fields that return Null-Only-On-Error types will never return the value {null}
1911-
if queried _unless_ an error has been logged for that field.
1910+
Fields that return Semantic-Non-Null types will never return the value {null} if
1911+
queried _unless_ an error has been logged for that field.
19121912

19131913
**Result Coercion**
19141914

1915-
To coerce the result of a Null-Only-On-Error type, the coercion of the wrapped
1915+
To coerce the result of a Semantic-Non-Null type, the coercion of the wrapped
19161916
type should be performed. If that result was not {null}, then the result of
1917-
coercing the Null-Only-On-Error type is that result. If that result was {null},
1917+
coercing the Semantic-Non-Null type is that result. If that result was {null},
19181918
then a _field error_ must be raised.
19191919

1920-
Note: When a _field error_ is raised on a Null-Only-On-Error value, the error
1920+
Note: When a _field error_ is raised on a Semantic-Non-Null value, the error
19211921
does not propagate to the parent field, instead {null} is used for the value.
19221922
For more information on this process, see
19231923
[Handling Field Errors](#sec-Handling-Field-Errors) within the Execution
19241924
section.
19251925

19261926
**Input Coercion**
19271927

1928-
Null-Only-On-Error types are never valid inputs.
1928+
Semantic-Non-Null types are never valid inputs.
19291929

19301930
**Type Validation**
19311931

1932-
1. A Null-Only-On-Error type must wrap an _output type_.
1933-
1. A Null-Only-On-Error type must not wrap another Null-Only-On-Error type.
1934-
1. A Null-Only-On-Error type must not wrap a Non-Null type.
1932+
1. A Semantic-Non-Null type must wrap an _output type_.
1933+
1. A Semantic-Non-Null type must not wrap another Semantic-Non-Null type.
1934+
1. A Semantic-Non-Null type must not wrap a Non-Null type.
19351935

1936-
### Combining List and Null-Only-On-Error
1936+
### Combining List and Semantic-Non-Null
19371937

1938-
The List and Null-Only-On-Error wrapping types can compose, representing more
1939-
complex types. The rules for result coercion of Lists and Null-Only-On-Error
1938+
The List and Semantic-Non-Null wrapping types can compose, representing more
1939+
complex types. The rules for result coercion of Lists and Semantic-Non-Null
19401940
types apply in a recursive fashion.
19411941

1942-
For example if the inner item type of a List is Null-Only-On-Error (e.g.
1943-
`[T*]`), then that List may not contain any {null} items unless associated field
1944-
errors were raised. However if the inner type of a Null-Only-On-Error is a List
1945-
(e.g. `[T]*`), then {null} is not accepted without an accompanying field error
1946-
being raised, however an empty list is accepted.
1942+
For example if the inner item type of a List is Semantic-Non-Null (e.g. `[!T]`),
1943+
then that List may not contain any {null} items unless associated field errors
1944+
were raised. However if the inner type of a Semantic-Non-Null is a List (e.g.
1945+
`![T]`), then {null} is not accepted without an accompanying field error being
1946+
raised, however an empty list is accepted.
19471947

19481948
Following are examples of result coercion with various types and values:
19491949

19501950
| Expected Type | Internal Value | Coerced Result |
19511951
| ------------- | --------------- | ------------------------------------------- |
1952-
| `[Int]*` | `[1, 2, 3]` | `[1, 2, 3]` |
1953-
| `[Int]*` | `null` | `null` (With logged coercion error) |
1954-
| `[Int]*` | `[1, 2, null]` | `[1, 2, null]` |
1955-
| `[Int]*` | `[1, 2, Error]` | `[1, 2, null]` (With logged error) |
1956-
| `[Int!]*` | `[1, 2, 3]` | `[1, 2, 3]` |
1957-
| `[Int!]*` | `null` | `null` (With logged coercion error) |
1958-
| `[Int!]*` | `[1, 2, null]` | `null` (With logged coercion error) |
1959-
| `[Int!]*` | `[1, 2, Error]` | `null` (With logged error) |
1960-
| `[Int*]` | `[1, 2, 3]` | `[1, 2, 3]` |
1961-
| `[Int*]` | `null` | `null` |
1962-
| `[Int*]` | `[1, 2, null]` | `[1, 2, null]` (With logged coercion error) |
1963-
| `[Int*]` | `[1, 2, Error]` | `[1, 2, null]` (With logged error) |
1964-
| `[Int*]!` | `[1, 2, 3]` | `[1, 2, 3]` |
1965-
| `[Int*]!` | `null` | Error: Value cannot be null |
1966-
| `[Int*]!` | `[1, 2, null]` | `[1, 2, null]` (With logged coercion error) |
1967-
| `[Int*]!` | `[1, 2, Error]` | `[1, 2, null]` (With logged error) |
1968-
| `[Int*]*` | `[1, 2, 3]` | `[1, 2, 3]` |
1969-
| `[Int*]*` | `null` | `null` (With logged coercion error) |
1970-
| `[Int*]*` | `[1, 2, null]` | `[1, 2, null]` (With logged coercion error) |
1971-
| `[Int*]*` | `[1, 2, Error]` | `[1, 2, null]` (With logged error) |
1952+
| `![Int]` | `[1, 2, 3]` | `[1, 2, 3]` |
1953+
| `![Int]` | `null` | `null` (With logged coercion error) |
1954+
| `![Int]` | `[1, 2, null]` | `[1, 2, null]` |
1955+
| `![Int]` | `[1, 2, Error]` | `[1, 2, null]` (With logged error) |
1956+
| `![Int!]` | `[1, 2, 3]` | `[1, 2, 3]` |
1957+
| `![Int!]` | `null` | `null` (With logged coercion error) |
1958+
| `![Int!]` | `[1, 2, null]` | `null` (With logged coercion error) |
1959+
| `![Int!]` | `[1, 2, Error]` | `null` (With logged error) |
1960+
| `[!Int]` | `[1, 2, 3]` | `[1, 2, 3]` |
1961+
| `[!Int]` | `null` | `null` |
1962+
| `[!Int]` | `[1, 2, null]` | `[1, 2, null]` (With logged coercion error) |
1963+
| `[!Int]` | `[1, 2, Error]` | `[1, 2, null]` (With logged error) |
1964+
| `[!Int]!` | `[1, 2, 3]` | `[1, 2, 3]` |
1965+
| `[!Int]!` | `null` | Error: Value cannot be null |
1966+
| `[!Int]!` | `[1, 2, null]` | `[1, 2, null]` (With logged coercion error) |
1967+
| `[!Int]!` | `[1, 2, Error]` | `[1, 2, null]` (With logged error) |
1968+
| `![!Int]` | `[1, 2, 3]` | `[1, 2, 3]` |
1969+
| `![!Int]` | `null` | `null` (With logged coercion error) |
1970+
| `![!Int]` | `[1, 2, null]` | `[1, 2, null]` (With logged coercion error) |
1971+
| `![!Int]` | `[1, 2, Error]` | `[1, 2, null]` (With logged error) |
19721972

19731973
## Directives
19741974

spec/Section 4 -- Introspection.md

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,14 @@ enum __TypeKind {
162162
INPUT_OBJECT
163163
LIST
164164
NON_NULL
165-
NULL_ONLY_ON_ERROR
165+
SEMANTIC_NON_NULL
166166
}
167167

168168
type __Field {
169169
name: String!
170170
description: String
171171
args(includeDeprecated: Boolean = false): [__InputValue!]!
172-
type(includeNullOnlyOnError: Boolean! = false): __Type!
172+
type(includeSemanticNonNull: Boolean! = false): __Type!
173173
isDeprecated: Boolean!
174174
deprecationReason: String
175175
}
@@ -264,7 +264,7 @@ possible value of the `__TypeKind` enum:
264264
- {"INPUT_OBJECT"}
265265
- {"LIST"}
266266
- {"NON_NULL"}
267-
- {"NULL_ONLY_ON_ERROR"}
267+
- {"SEMANTIC_NON_NULL"}
268268

269269
**Scalar**
270270

@@ -403,34 +403,32 @@ required inputs for arguments and input object fields.
403403
The modified type in the `ofType` field may itself be a modified List type,
404404
allowing the representation of Non-Null of Lists. However it must not be a
405405
modified Non-Null type to avoid a redundant Non-Null of Non-Null; nor may it be
406-
a modified Null-Only-On-Error type since these types are mutually exclusive.
406+
a modified Semantic-Non-Null type since these types are mutually exclusive.
407407

408408
Fields\:
409409

410410
- `kind` must return `__TypeKind.NON_NULL`.
411-
- `ofType` must return a type of any kind except Non-Null and
412-
Null-Only-On-Error.
411+
- `ofType` must return a type of any kind except Non-Null and Semantic-Non-Null.
413412
- All other fields must return {null}.
414413

415-
**Null-Only-On-Error**
414+
**Semantic-Non-Null**
416415

417416
GraphQL types are nullable. The value {null} is a valid response for field type.
418417

419-
A Null-Only-On-Error type is a type modifier: it wraps another _output type_
420-
instance in the `ofType` field. Null-Only-On-Error types do not allow {null} as
421-
a response _unless_ an associated _field error_ has been raised.
418+
A Semantic-Non-Null type is a type modifier: it wraps another _output type_
419+
instance in the `ofType` field. Semantic-Non-Null types do not allow {null} as a
420+
response _unless_ an associated _field error_ has been raised.
422421

423422
The modified type in the `ofType` field may itself be a modified List type,
424-
allowing the representation of Null-Only-On-Error of Lists. However it must not
425-
be a modified Null-Only-On-Error type to avoid a redundant Null-Only-On-Error of
426-
Null-Only-On-Error; nor may it be a modified Non-Null type since these types are
423+
allowing the representation of Semantic-Non-Null of Lists. However it must not
424+
be a modified Semantic-Non-Null type to avoid a redundant Null-Only-On-Error of
425+
Semantic-Non-Null; nor may it be a modified Non-Null type since these types are
427426
mutually exclusive.
428427

429428
Fields\:
430429

431-
- `kind` must return `__TypeKind.NULL_ONLY_ON_ERROR`.
432-
- `ofType` must return a type of any kind except Non-Null and
433-
Null-Only-On-Error.
430+
- `kind` must return `__TypeKind.SEMANTIC_NON_NULL`.
431+
- `ofType` must return a type of any kind except Non-Null and Semantic-Non-Null.
434432
- All other fields must return {null}.
435433

436434
### The \_\_Field Type
@@ -447,24 +445,24 @@ Fields\:
447445
{true}, deprecated arguments are also returned.
448446
- `type` must return a `__Type` that represents the type of value returned by
449447
this field.
450-
- Accepts the argument `includeNullOnlyOnError` which defaults to {false}. If
448+
- Accepts the argument `includeSemanticNonNull` which defaults to {false}. If
451449
{false}, let {fieldType} be the type of value returned by this field and
452450
instead return a `__Type` that represents
453-
{RecursivelyStripNullOnlyOnErrorTypes(fieldType)}.
451+
{RecursivelyStripSemanticNonNullTypes(fieldType)}.
454452
- `isDeprecated` returns {true} if this field should no longer be used,
455453
otherwise {false}.
456454
- `deprecationReason` optionally provides a reason why this field is deprecated.
457455

458-
RecursivelyStripNullOnlyOnErrorTypes(type):
456+
RecursivelyStripSemanticNonNullTypes(type):
459457

460-
- If {type} is a Null-Only-On-Error type:
458+
- If {type} is a Semantic-Non-Null type:
461459
- Let {innerType} be the inner type of {type}.
462-
- Return {RecursivelyStripNullOnlyOnErrorTypes(innerType)}.
460+
- Return {RecursivelyStripSemanticNonNullTypes(innerType)}.
463461
- Otherwise, return {type}.
464462

465-
Note: This algorithm recursively removes all Null-Only-On-Error type wrappers
466-
(e.g. `[[Int*]!]*` would become `[[Int]!]`). This is to support legacy clients:
467-
they can safely treat a Null-Only-On-Error type as the underlying nullable type.
463+
Note: This algorithm recursively removes all Semantic-Non-Null type wrappers
464+
(e.g. `![[!Int]!]` would become `[[Int]!]`). This is to support legacy clients:
465+
they can safely treat a Semantic-Non-Null type as the underlying nullable type.
468466

469467
### The \_\_InputValue Type
470468

spec/Section 6 -- Execution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ field execution process continues recursively.
670670

671671
CompleteValue(fieldType, fields, result, variableValues):
672672

673-
- If the {fieldType} is a Non-Null or a Null-Only-On-Error type:
673+
- If the {fieldType} is a Non-Null or a Semantic-Non-Null type:
674674
- Let {innerType} be the inner type of {fieldType}.
675675
- Let {completedResult} be the result of calling {CompleteValue(innerType,
676676
fields, result, variableValues)}.
@@ -806,5 +806,5 @@ If all fields from the root of the request to the source of the field error
806806
return `Non-Null` types, then the {"data"} entry in the response should be
807807
{null}.
808808

809-
Note: By the above, field errors that happen in `Null-Only-On-Error` types do
810-
not propagate.
809+
Note: By the above, field errors that happen in `Semantic-Non-Null` types do not
810+
propagate.

0 commit comments

Comments
 (0)