Skip to content

stack-labs-tech/graphql-java-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# fields

{
  parents {
    firstnameParent1
    firstnameParent2
    lastnameParent1
    lastnameParent2
    babies {
      firstname
      activities {
        category
      }
    }
  }
}

{
  nannies {
    firstname
    lastname
    id
    babies {
      firstname
    }
  }
}

# arguments
{
  parentById(id:1) {
    lastnameParent1
    firstnameParent1
    lastnameParent2
    firstnameParent2
  }
}

# aliases
{
  parent1: parentById(id:1) {
    lastnameParent1
    firstnameParent1
    lastnameParent2
    firstnameParent2
  }
}

# fragments
{
  leftComparison: parentById(id:1) {
    ...comparisonFields
  }
  rightComparison: parentById(id:2) {
    ...comparisonFields
  }
}

fragment comparisonFields on Parent {
  lastnameParent1
  firstnameParent1
  lastnameParent2
  firstnameParent2
}

# variables
query findParentById($id: Int) {
  parentById(id:$id) {
    lastnameParent1
    firstnameParent1
    lastnameParent2
    firstnameParent2
  }
}

{
  "id": 1
}

# directives
query findParentById($id: Int, $withBabies: Boolean!) {
  parent(id:$id, withBabies: $withBabies) {
    lastnameParent1
    firstnameParent1
    lastnameParent2
    firstnameParent2
    babies @include(if: $withBabies) {
      firstname
      lastname
    }
  }
}

{
  "id": 1,
  "withBabies": true
}

# mutation

# create
mutation createParent($prtInput: ParentInput) {
  createParent(parent: $prtInput)
}

{
  "prtInput": {
    "firstnameParent1": "Michel",
    "lastnameParent1": "Aymerican",
    "firstnameParent2": "Michelle",
    "lastnameParent2": "Aymerican"
  }
}

# delete
mutation deleteParent($id: ID) {
  deleteParent(id: $id)
}

{
  "id": 2
}