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→TypedGql.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 TypedGql.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
Builds the typespec AST for a (possibly nested) list type, with leaf_ast
standing in for the innermost element.
Resolves a GraphQL type reference to its Ecto type and nullability.
Types
Functions
@spec list_type_ast(TypedGql.Schema.TypeRef.t(), Macro.t()) :: Macro.t()
Builds the typespec AST for a (possibly nested) list type, with leaf_ast
standing in for the innermost element.
Every list level and every element carries its own nullability in GraphQL and
the Ecto type keeps none of it, so the AST is built from the type reference:
[Post] with leaf Post.t() gives [Post.t() | nil].
The outermost | nil is deliberately omitted — typed_structor appends it
from the field's null: option, so a generation plugin flipping nullability
still flows through.
@spec resolve(TypedGql.Schema.TypeRef.t(), TypedGql.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 isTypedGql.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:%{})