Skip to main contentNedix.io

GraphQL

Examples

Named queries

query GetPerson($id: ID!) {
person(id: $id) {
name
age
}
}

Mutations

mutation {
addPerson(input: { name: "Alice", age: 30 }) {
id
name
age
}
}

Interfaces

interface Animal {
name: String!
makeSound: String!
}
type Dog implements Animal {
name: String!
makeSound: String!
breed: String!

Types

input PersonInput {
name: String!
age: Int!
}
type Mutation {
addPerson(input: PersonInput!): Person!
}

Enums

enum UserRole {
ADMIN
USER
GUEST
}
type User {
role: UserRole!
username: String!