GraphQL

Write an awesome doc for GraphQL. A very nice an practical one extracted from GraphQL official documentation.

View on GitHub

Diagnose GraphQL query language

Breaking down a query

Jargons

Breakdown a schema type

Arguments and default value

GraphQL Object type
A type with some fields.
Field
Fields that can appear in any part of a GraphQL query that operates on the Character type.
List type
An array of the specified type.
Cannot define a non-empty list (an array with at least one member).
A type modifier.
Non-Null type
The GraphQL service promises to give you a value whenever you query this field.
A type modifier.
Argument
Arguments in GraphQL are passed by name specifically. Order does not matter!
All arguments are named.
Every field on a GraphQL Object type can have zero or more arguments.
Can be required or optional.

[!TIP]

[type] VS [type]! VS [type!] VS [type!]!

Non-Null and list

The Query, Mutation, and Subscription types

[!IMPORTANT]

  • Every GraphQL schema must support query operations.
  • The entry point of a “root” operation type is a regular Object type called Query by default.

Mandatory Query object type in GraphQL