# `BB.Parameter.Schema`
[🔗](https://github.com/beam-bots/bb/blob/main/lib/bb/parameter/schema.ex#L5)

Builds nested Spark.Options schemas from flat parameter definitions.

This module converts the flat `[{path, opts}]` format from
`__bb_parameter_schema__/0` into nested keyword lists suitable for
validating `start_link` options.

## Example

    iex> flat = [
    ...>   {[:motion, :max_speed], [type: :float, default: 1.0]},
    ...>   {[:motion, :acceleration], [type: :float, default: 0.5]},
    ...>   {[:debug_mode], [type: :boolean, default: false]}
    ...> ]
    iex> BB.Parameter.Schema.build_nested_schema(flat)
    [
      debug_mode: [type: :boolean],
      motion: [type: :keyword_list, keys: [
        acceleration: [type: :float],
        max_speed: [type: :float]
      ]]
    ]

# `build_nested_schema`

```elixir
@spec build_nested_schema([{[atom()], keyword()}]) :: keyword()
```

Builds a nested Spark.Options schema from flat `[{path, opts}]` list.

The resulting schema can be passed to `Spark.Options.validate/2` to validate
nested keyword lists like `[motion: [max_speed: 2.0]]`.

All parameters are optional (no `:required` flag) since we're validating
partial overrides. The `:default` key is removed from each parameter's opts
since defaults are handled separately by the DSL.

# `flatten_params`

```elixir
@spec flatten_params(keyword()) :: [{[atom()], term()}]
```

Flattens nested keyword params to `[{path, value}]` format.

This is the inverse of the nesting - it takes validated params like
`[motion: [max_speed: 2.0]]` and returns `[{[:motion, :max_speed], 2.0}]`.

---

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