BB.Parameter.Type (bb v0.15.0)
View SourceValidation for parameter type definitions in the DSL.
Parameters can have simple types (:float, :integer, etc.) or unit types
like {:unit, :meter}.
Summary
Functions
Validates a parameter type specification.
Functions
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}whereunit_typeis 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"}