Schema
The schema file describes the shape of your data, relations, and configuration for validations and auth using the GraphQL schema definition language.
Grafbase automatically generates a GraphQL schema, and deploys a GraphQL API to the edge based on schema located at grafbase/schema.graphql
.
You can create a model using the directive @model
with any of your GraphQL types. Each model will have its own set of GraphQL queries and mutations.
type Post @model {
slug: String! @unique
title: String!
published: Boolean @default(value: false)
rating: Float
likes: Int
}
You can also create regular object types that can be embedded inside of your existing models:
type Order @model {
billingAddress: Address
shippingAddress: Address
}
type Address {
line1: String!
line2: String
zip: String
phone: PhoneNumber
}
Grafbase automatically manages system fields for any @model
type.
Models contain fields.
Grafbase does not currently support Interface
or Union
types.