# `Grephql.InputTypeGenerator`
[🔗](https://github.com/fahchen/grephql/blob/v0.10.1/lib/grephql/input_type_generator.ex#L1)

Generates Ecto embedded schema modules for GraphQL input types.

Unlike `Grephql.TypeGenerator` (per-query output types), input types are
schema-level and shared across queries. Each input object type
generates one module under `ClientModule.Inputs.InputTypeName`.

Generated modules include a `build/1` function that validates
parameters via Ecto changeset and returns `{:ok, struct}` or
`{:error, changeset}`.

# `option`

```elixir
@type option() ::
  {:client_module, module()} | {:function_name, atom()} | {:scalar_types, map()}
```

# `generate`

```elixir
@spec generate(Grephql.Language.OperationDefinition.t(), Grephql.Schema.t(), [
  option()
]) :: [module()]
```

Generates input type modules for all input types referenced by
an operation's variable definitions.

Returns a list of generated module names.

## Options

  - `:client_module` — the parent client module (e.g., `MyApp.UserService`)
  - `:scalar_types` — custom scalar type mappings (default: `%{}`)

# `generate_variables`

```elixir
@spec generate_variables(
  Grephql.Language.OperationDefinition.t(),
  Grephql.Schema.t(),
  [option()]
) :: module() | nil
```

Generates a Variables struct for an operation's variable definitions.

Returns the Variables module name, or `nil` if the operation has no variables.
Variable field names are snake_cased with `source:` mapping to the original
GraphQL variable name for correct serialization via `Ecto.embedded_dump/2`.

## Options

  - `:client_module` — the parent client module
  - `:function_name` — the defgql function name (for module path)
  - `:scalar_types` — custom scalar type mappings (default: `%{}`)

---

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