Featurevisor Schemas for Elixir

This package validates data against the schemas a Featurevisor datafile carries, with the same rules, messages and conditions as @featurevisor/schemas in JavaScript.

Schemas are experimental, so their API may change in a minor release, as in JavaScript.

Installation

def deps do
  [
    {:featurevisor, "~> 2.1"},
    {:featurevisor_schemas, "~> 2.1"}
  ]
end

The package needs the same version of featurevisor.

Usage

schemas = FeaturevisorSchemas.create(f)

case FeaturevisorSchemas.validate(schemas, "signUp", params) do
  {:ok, params} -> create_account(params)
  {:error, issues} -> render_errors(FeaturevisorSchemas.flatten(issues))
end

Handles describe a schema's fields for rendering a form, and checks in code run after the rules. See the Elixir SDK documentation for handles, messages, refinements and option sources.

License

MIT