schema.gql docs

Docs for schema.gql

API Endpoints
https://github.com/HugoDF/spectaql-example

Queries

books

Response

Returns [Book!]!

Example

Query
query Books {
  books {
    id
    title
    author
  }
}
Response
{
  "data": {
    "books": [
      {
        "id": "784a07a9-d103-4ccb-926f-b38fc6b071f2",
        "title": "abc123",
        "author": "xyz789"
      }
    ]
  }
}

Mutations

addBook

Description

Supports GraphQL descriptions

Response

Returns a Book!

Arguments
Name Description
book - BookInput!

Example

Query
mutation AddBook($book: BookInput!) {
  addBook(book: $book) {
    id
    title
    author
  }
}
Variables
{"book": BookInput}
Response
{
  "data": {
    "addBook": {
      "id": "784a07a9-d103-4ccb-926f-b38fc6b071f2",
      "title": "xyz789",
      "author": "xyz789"
    }
  }
}

Types

Book

Fields
Field Name Description
id - ID!
title - String!
author - String!
Example
{
  "id": "784a07a9-d103-4ccb-926f-b38fc6b071f2",
  "title": "abc123",
  "author": "xyz789"
}

BookInput

Fields
Input Field Description
id - ID!
title - String!
author - String! Deprecated we're still waiting for @deprecated on input fields (note that markdown in GQL descriptions works)
Example
{
  "id": "447f51e8-27d0-4827-b3d0-140b8e78bd47",
  "title": "xyz789",
  "author": "xyz789"
}

Boolean

Description

The Boolean scalar type represents true or false.

Example
true

ID

Description

The ID scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4") or integer (such as 4) input value will be accepted as an ID.

Example
4

String

Description

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Example
"xyz789"