Type Mapping
Automatic Type Mapping
Section titled “Automatic Type Mapping”Quail maps ActiveRecord column types to GraphQL types automatically:
| ActiveRecord | GraphQL |
|---|---|
integer | Int |
bigint | BigInt |
float, decimal | Float |
string, text | String |
boolean | Boolean |
date | ISO8601Date |
datetime, time | ISO8601DateTime |
json, jsonb | JSON |
id column | ID |
When Quail generates a GraphQL type from a resource, it inspects the model’s columns and applies this mapping to determine the field types. The id column is always mapped to the GraphQL ID type regardless of its underlying database type.
For types that don’t fit this mapping (enums, value objects, custom scalars), use computed attributes or custom types.