Confispex.Type.cast

You're seeing just the function cast, go back to Confispex.Type module for more information.
Link to this function

cast(value, type)

Specs

cast(input :: any(), type_reference()) ::
  {:ok, output :: any()}
  | {:error, {failed_on_value :: any(), type_reference(), error_details()}}

Cast input using type in type_reference()

Examples

iex> Confispex.Type.cast("dev", {Confispex.Type.Enum, values: [:prod, :test, :dev]})
{:ok, "dev"}

iex> Confispex.Type.cast("prodd", {Confispex.Type.Enum, values: [:prod, :test, :dev]})
{:error,
 {"prodd", {Confispex.Type.Enum, [values: [:prod, :test, :dev]]},
  [
    validation: [
      "expected one of: ",
      [
        {:highlight, "prod"},
        ", ",
        {:highlight, "test"},
        ", ",
        {:highlight, "dev"}
      ]
    ]
  ]}}