Skip to content

Commit

Permalink
Add more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Oct 17, 2024
1 parent 0c9830e commit c4d0b50
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion spec/Section 5 -- Validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ type Query {
}

type Mutation {
addPet(pet: PetInput): Pet
addPet(pet: PetInput!): Pet
addPets(pet: [PetInput!]!): [Pet]
}

enum DogCommand {
Expand Down Expand Up @@ -1351,6 +1352,12 @@ query goodComplexDefaultValue($search: FindDogInput = { name: "Fido" }) {
name
}
}

mutation addPet($pet: PetInput! = { cat: { name: "Brontie" } }) {
addPet(pet: $pet) {
name
}
}
```

Non-coercible values (such as a String into an Int) are invalid. The following
Expand All @@ -1366,6 +1373,24 @@ query badComplexValue {
name
}
}

mutation oneOfWithNoFields {
addPet(pet: {}) {
name
}
}

mutation oneOfWithTwoFields($dog: DogInput) {
addPet(pet: { cat: { name: "Brontie" }, dog: $dog }) {
name
}
}

mutation listOfOneOfWithNullableVariable($dog: DogInput) {
addPets(pets: [{ dog: $dog }]) {
name
}
}
```

### Input Object Field Names
Expand Down

0 comments on commit c4d0b50

Please sign in to comment.