Schema Definition
Prism’s GraphQL engine lets you define schemas entirely in Swift using a typed DSL. Every field, argument, and type is a first-class Swift value — you get compiler checks, autocomplete, and zero code generation.Type System
GraphQL types map directly toPrismGraphQLType:
Available Types
Defining Fields
Each field has a name, type, optional arguments, and a resolver function:Field with Resolver
Fields with Arguments
Field with Arguments
Object Types
Group fields into object types:User Type
Building a Complete Schema
Blog Schema Example
Complete Blog Schema
The schema object is
Sendable and can be shared across concurrent requests safely. Define it once at startup and pass it to your middleware.Schema with Type Registry
For schemas with nested object types (e.g., a User that has Posts), register types in the schema so the executor can resolve nested selections:Registering Types
What’s Next
Queries
Learn how to write resolvers and handle nested data
Mutations
Create, update, and delete data through GraphQL