This topic describes the GraphQL schema definition language (SDL), based on the [GraphQL specification] ( that Grafbase uses. It contains information about our implementation of the specification, as well as any slight deviations from the specification.

Grafbase supports the following directives:

  • @auth — This directive tells Grafbase how to handle authentication, and authorization with users accessing your data.
  • @model — This type directive instructs Grafbase to create an entry in the database for objects of the type.
  • @unique — This field directive validates the uniqueness of this field in the type collection. Note: The value is case-sensitive.

Currently the first and last arguments specify whether you can retrieve up to 100 of the first or last objects in a collection. But what happens if you have more than 100 objects? You can use pagination to get up to another 100.

Here's how it works. Say you are using our todo template, and you want to retrieve all of your Todo objects, 20 at a time.

Here's what the first query looks like:

Which returns something like the following (we’re only showing the first and last todo objects to save space):

So to get the next 20 todo objects, you use the value of endCursor and supply an after argument to the query:

And repeat until hasNextPage is false.

You can also start from the end of the list using last, hasPreviousPage, startCursor, and before.