Maps GraphQL type references to Ecto schema types.
Resolves the corresponding Ecto type (for embedded schema field definitions) and nullability from a parsed GraphQL type reference.
Scalar mapping
Built-in GraphQL scalars map to Ecto primitives:
String→:stringInt→:integerFloat→:floatBoolean→:booleanID→:stringDateTime→Grephql.Types.DateTimeDate→:dateJSON/JSONObject→:mapURI/URL→:stringBigInt/Long→:integerHTML→:stringUnsignedInt64→:integerBase64String→:string
Custom scalars map to user-provided Ecto.Type modules via the scalar_types config.
Custom scalars override built-in defaults. Unknown scalars raise CompileError.
Enum mapping
Enum types are automatically resolved using Grephql.Types.Enum (a parameterized
Ecto type). No user configuration is needed — enum values are read from the schema
at compile time. Users can still override enum types via scalar_types if custom
serialization is needed.
Summary
Functions
Resolves a GraphQL type reference to its Ecto type and nullability.
Types
Functions
@spec resolve(Grephql.Schema.TypeRef.t(), Grephql.Schema.t(), scalar_types()) :: resolve_result()
Resolves a GraphQL type reference to its Ecto type and nullability.
Returns a map with:
:ecto_type— the Ecto type for schema field definition:nullable— whether the field allows nil:enum_values— enum value strings when type isGrephql.Types.Enum, nil otherwise
Parameters
type_ref— the GraphQL type reference to resolveschema— the parsed GraphQL schema (for enum value lookup)scalar_types— user-provided custom scalar mappings (default:%{})