Skip to content
GraphQL

Schema and Types

Define types, enums, and scalars.

#schema#type#enum

Code

graphql
type Author {
  id: ID!
  name: String!
  bio: String
  books: [Book!]!
}

type Book {
  id: ID!
  title: String!
  author: Author!
  pages: Int
  published: Boolean
}

enum Genre {
  FICTION
  NON_FICTION
  SCIENCE
}

scalar DateTime