Example 4538

GraphQL Schema

GraphQL type and resolver configuration.

{
schema: {
query: "Query"
mutation: "Mutation"
}

types: {
# User type
User: {
fields: {
id: "ID!"
name: "String!"
email: "String!"
avatar: "String"
posts: "[Post!]!"
role: "Role!"
}
}

# Post type
Post: {
fields: {
id: "ID!"
title: "String!"
body: "String!"
author: "User!"
published: "Boolean!"
created_at: "DateTime!"
}
}
}

resolvers: {
cache: true
max_depth: 10
max_complexity: 921
}
}

See also