# `TypedGql.Generation.Schema`
[🔗](https://github.com/fahchen/typed_gql/blob/v0.11.0/lib/typed_gql/generation/schema.ex#L1)

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.

# `kind`

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

# `t`

```elixir
@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()) =&gt; module()},
  union_module: module() | nil
}
```

# `map_fields`

```elixir
@spec map_fields(t(), (TypedGql.Generation.Field.t() -&gt; 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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
