Skip to content

Instantly share code, notes, and snippets.

@mtvspec
Last active July 19, 2020 16:07
Show Gist options
  • Save mtvspec/e6b32ac7ce91bb3db887b94187840821 to your computer and use it in GitHub Desktop.
Save mtvspec/e6b32ac7ce91bb3db887b94187840821 to your computer and use it in GitHub Desktop.
GraphQL Schema Example
type Query {
bookList: [BookList!]
book(id: ID!): Book
authorList: [AuthorList!]
author(id: ID!): Author
}
type Book {
id: ID!
title: String!
description: String
author: Author!
}
type BookList {
count: Int
nodes: [Book!]
}
type Author {
id: ID!
name: String!
bookList: AuthorBookList!
}
type AuthorList {
count: Int!
nodes: [Author!]
}
type AuthorBookList {
count: Int!
nodes: [Book!]
}
input BookInput {
title: String!
description: String
author: ID!
}
input AuthorInput {
name: String!
bookList: [BookInput!]
}
type Mutation {
createBook(data: BookInput!): Book
updateBook(id: ID! data: BookInput): Book
deleteBook(id: ID!): Book
createAuthor(data: AuthorInput!): Author
updateAuthor(id: ID! data: AuthorInput!): Author
deleteAuthor(id: ID!): Author
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment