Skip to content

Commit 0c9830e

Browse files
committed
Clarify OneOf examples
1 parent b45c0e4 commit 0c9830e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

spec/Section 5 -- Validation.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,25 +2004,25 @@ Similarly a `[T]` cannot be passed to a `[T!]`.
20042004
Variables used for OneOf Input Object fields must be non-nullable.
20052005

20062006
```graphql example
2007-
mutation addPet($cat: CatInput!) {
2007+
mutation addCat($cat: CatInput!) {
20082008
addPet(pet: { cat: $cat }) {
20092009
name
20102010
}
20112011
}
2012-
```
2013-
2014-
```graphql counter-example
2015-
mutation addPet($cat: CatInput) {
2012+
mutation addCatWithDefault($cat: CatInput! = { name: "Brontie" }) {
20162013
addPet(pet: { cat: $cat }) {
20172014
name
20182015
}
20192016
}
20202017
```
20212018

2022-
Variables used for OneOf Input Object fields cannot have default values.
2023-
20242019
```graphql counter-example
2025-
mutation addPet($cat: CatInput = { name: "Kitty" }) {
2020+
mutation addNullableCat($cat: CatInput) {
2021+
addPet(pet: { cat: $cat }) {
2022+
name
2023+
}
2024+
}
2025+
mutation addNullableCatWithDefault($cat: CatInput = { name: "Brontie" }) {
20262026
addPet(pet: { cat: $cat }) {
20272027
name
20282028
}

0 commit comments

Comments
 (0)