TypedGql.Generation.Schema (typedGql v0.11.0)

Copy Markdown View Source

A node in the generated-schema tree, built by the resolve step before lowering to EctoTypedSchema AST.

Two node shapes share this struct:

  • object node — kind: :object, carries fields and children (child nodes for embedded objects). Lowers to one typed_embedded_schema module.
  • union node — kind: :union, carries union_module, typename_to_module, and children (one object node per concrete type). Lowers to the concrete-type modules; the parameterized TypedGql.Types.Union type module is created eagerly during resolve because Ecto validates parameterized type modules exist at schema compile time.

The full tree for an operation is built before any lowering happens, so lifecycle plugins see the complete structure.

Summary

Functions

Walks the whole tree applying fun to every TypedGql.Generation.Field.

Types

kind()

@type kind() :: :object | :union

t()

@type t() :: %TypedGql.Generation.Schema{
  children: [t()],
  fields: [TypedGql.Generation.Field.t()],
  kind: kind(),
  module: module(),
  parent_type: String.t() | nil,
  typename_to_module: %{required(String.t()) => module()},
  union_module: module() | nil
}

Functions

map_fields(node, fun)

@spec map_fields(t(), (TypedGql.Generation.Field.t() -> TypedGql.Generation.Field.t())) ::
  t()

Walks the whole tree applying fun to every TypedGql.Generation.Field.

Lets directive plugins transform fields without recursion boilerplate. Recurses into both embedded-object children and union variants.