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

Validation for parameter type definitions in the DSL.

Parameters can have simple types (`:float`, `:integer`, etc.) or unit types
like `{:unit, :meter}`.

# `validate`

```elixir
@spec validate(term()) :: {:ok, atom() | {:unit, atom()}} | {:error, String.t()}
```

Validates a parameter type specification.

Returns `{:ok, type}` for valid types or `{:error, message}` for invalid ones.

## Valid Types

- Simple types: `:float`, `:integer`, `:boolean`, `:string`, `:atom`
- Unit types: `{:unit, unit_type}` where `unit_type` is a valid CLDR unit

## Examples

    iex> BB.Parameter.Type.validate(:float)
    {:ok, :float}

    iex> BB.Parameter.Type.validate({:unit, :meter})
    {:ok, {:unit, :meter}}

    iex> BB.Parameter.Type.validate(:invalid)
    {:error, "Expected one of [:float, :integer, :boolean, :string, :atom] or {:unit, unit_type}, got: :invalid"}

---

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