Skip to content

023 - GraphQL Schema

GraphQL type and resolver configuration. This is an example of a MAML document.

maml
{
  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: 12
    max_complexity: 884
  }
}

See Also