Skip to content

Commit 99aa5d9

Browse files
committed
Remove Oneof Fields from spec
1 parent c470afb commit 99aa5d9

File tree

3 files changed

+6
-68
lines changed

3 files changed

+6
-68
lines changed

spec/Section 3 -- Type System.md

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -879,9 +879,6 @@ of rules must be adhered to by every Object type in a GraphQL schema.
879879
{"\_\_"} (two underscores).
880880
2. The argument must accept a type where {IsInputType(argumentType)}
881881
returns {true}.
882-
3. If the field is a Oneof Field:
883-
1. The argument must be nullable.
884-
2. The argument must not have a default value.
885882
3. An object type may declare that it implements one or more unique interfaces.
886883
4. An object type must be a super-set of all interfaces it implements:
887884
1. Let this object type be {objectType}.
@@ -909,8 +906,6 @@ IsValidImplementation(type, implementedType):
909906
2. Let {implementedFieldType} be the return type of {implementedField}.
910907
3. {IsValidImplementationFieldType(fieldType, implementedFieldType)} must
911908
be {true}.
912-
6. {field} must be a Oneof Field if and only if {implementedField} is a
913-
Oneof Field.
914909

915910
IsValidImplementationFieldType(fieldType, implementedFieldType):
916911

@@ -984,31 +979,6 @@ May return the result:
984979
The type of an object field argument must be an input type (any type except an
985980
Object, Interface, or Union type).
986981

987-
**Oneof Fields**
988-
989-
Oneof Fields are a special variant of Object Type fields where the type system
990-
asserts that exactly one of the field's arguments must be set and non-null, all
991-
others being omitted. This is useful for representing situations where a field
992-
provides more than one input option to accomplish the same (or similar) goal.
993-
994-
When using the type system definition language, the `@oneOf` directive is used
995-
to indicate that a Field is a Oneof Field (and thus requires exactly one of its
996-
arguments be provided):
997-
998-
```graphql
999-
type Query {
1000-
findUser(
1001-
byID: ID
1002-
byUsername: String
1003-
byEmail: String
1004-
byRegistrationNumber: Int
1005-
): User @oneOf
1006-
}
1007-
```
1008-
1009-
In schema introspection, the `__Field.oneOf` field will return {true} for Oneof
1010-
Fields, and {false} for all other Fields.
1011-
1012982
### Field Deprecation
1013983

1014984
Fields in an object may be marked as deprecated as deemed necessary by the
@@ -1254,9 +1224,6 @@ Interface types have the potential to be invalid if incorrectly defined.
12541224
{"\_\_"} (two underscores).
12551225
2. The argument must accept a type where {IsInputType(argumentType)}
12561226
returns {true}.
1257-
3. If the field is a Oneof Field:
1258-
1. The argument must be nullable.
1259-
2. The argument must not have a default value.
12601227
3. An interface type may declare that it implements one or more unique
12611228
interfaces, but may not implement itself.
12621229
4. An interface type must be a super-set of all interfaces it implements:
@@ -1712,7 +1679,7 @@ input ExampleInputObject {
17121679
| `{ b: $var }` | `{ var: null }` | Error: {b} must be non-null. |
17131680
| `{ b: 123, c: "xyz" }` | `{}` | Error: Unexpected field {c} |
17141681

1715-
Following are examples of input coercion for a Oneof Input Object with a
1682+
Following are examples of input coercion for a oneOf input object type with a
17161683
`String` member field `a` and an `Int` member field `b`:
17171684

17181685
```graphql example
@@ -2007,8 +1974,7 @@ GraphQL implementations that support the type system definition language should
20071974
provide the `@specifiedBy` directive if representing custom scalar definitions.
20081975

20091976
GraphQL implementations that support the type system definition language should
2010-
provide the `@oneOf` directive if the schema contains Oneof Input Objects or
2011-
Oneof Fields.
1977+
provide the `@oneOf` directive if representing Oneof Input Objects.
20121978

20131979
When representing a GraphQL schema using the type system definition language any
20141980
_built-in directive_ may be omitted for brevity.
@@ -2201,14 +2167,11 @@ scalar UUID @specifiedBy(url: "https://tools.ietf.org/html/rfc4122")
22012167
### @oneOf
22022168

22032169
```graphql
2204-
directive @oneOf on INPUT_OBJECT | FIELD_DEFINITION
2170+
directive @oneOf on INPUT_OBJECT
22052171
```
22062172

22072173
The `@oneOf` directive is used within the type system definition language to
2208-
indicate:
2209-
2210-
- an Input Object is a Oneof Input Object, or
2211-
- an Object Type's Field is a Oneof Field.
2174+
indicate an Input Object is a Oneof Input Object.
22122175

22132176
```graphql example
22142177
input UserUniqueCondition @oneOf {

spec/Section 4 -- Introspection.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ type __Field {
172172
type: __Type!
173173
isDeprecated: Boolean!
174174
deprecationReason: String
175-
oneOf: Boolean!
176175
}
177176

178177
type __InputValue {
@@ -370,8 +369,8 @@ Fields\:
370369
- `name` must return a String.
371370
- `description` may return a String or {null}.
372371
- `inputFields` must return the set of input fields as a list of `__InputValue`.
373-
- `oneOf` must return {true} for Oneof Input Objects, {false} for all other
374-
Input Objects.
372+
- `oneOf` must return {true} when representing a Oneof Input Object, {false}
373+
otherwise.
375374
- All other fields must return {null}.
376375

377376
**List**
@@ -422,7 +421,6 @@ Fields\:
422421
- `isDeprecated` returns {true} if this field should no longer be used,
423422
otherwise {false}.
424423
- `deprecationReason` optionally provides a reason why this field is deprecated.
425-
- `oneOf` must return {true} for Oneof Fields, {false} for all other Fields.
426424

427425
### The \_\_InputValue Type
428426

spec/Section 5 -- Validation.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -804,29 +804,6 @@ fragment missingRequiredArg on Arguments {
804804
}
805805
```
806806

807-
#### Oneof Fields Have Exactly One Argument
808-
809-
- For each {operation} in {document}:
810-
- Let {oneofFields} be all Oneof Fields transitively included in the
811-
{operation}.
812-
- For each {oneofField} in {oneofFields}:
813-
- Let {arguments} be the arguments provided by {oneofField}.
814-
- {arguments} must contain exactly one entry.
815-
- Let {argument} be the sole entry in {arguments}.
816-
- Let {value} be the value of {argument}.
817-
- {value} must not be the {null} literal.
818-
- If {value} is a variable:
819-
- Let {variableName} be the name of {variable}.
820-
- Let {variableDefinition} be the {VariableDefinition} named
821-
{variableName} defined within {operation}.
822-
- Let {variableType} be the expected type of {variableDefinition}.
823-
- {variableType} must be a non-null type.
824-
825-
**Explanatory Text**
826-
827-
Oneof Fields require that exactly one argument must be supplied and that
828-
argument must not be null.
829-
830807
## Fragments
831808

832809
### Fragment Declarations

0 commit comments

Comments
 (0)