Skip to main content
Orionjs schemas automatically integrate with GraphQL, providing a seamless type-safe experience from your database to your API.

Basic Integration

When you define a schema with schemaWithName(), it can be used directly in GraphQL resolvers:
Orionjs will automatically:
  1. Generate the GraphQL type for UserSchema
  2. Validate the resolver’s return value against the schema
  3. Convert any special types (like dates) to the appropriate GraphQL format

GraphQL Schema Customization

You can customize how a schema appears in GraphQL:

Generated GraphQL Types

The following table shows how schema types map to GraphQL types:

Using Schemas for GraphQL Inputs

Schemas can be used for input validation:

Custom GraphQL Type Resolvers

For complex field types, you can add custom resolvers: