wpl_validator

Hex.pmCILicense

Reference Elixir validator for WPL (Wellness Plan Language). Sister implementation of @gymbile/wpl-validator — same conformance suite, identical (code, path) results.

Install

def deps do
  [
    {:wpl_validator, "~> 1.0"}
  ]
end

Usage

{:ok, plan} = Jason.decode(json_string)

result = WPL.Validator.validate(plan)
# %WPL.Validator.Result{
#   valid?: true,
#   errors: []
# }

With a catalog (resolves *_ref checks):

catalog = %{
  exercises: MapSet.new(["push_up", "squat"]),
  meals: MapSet.new(["oatmeal"])
}
WPL.Validator.validate(plan, catalog: catalog)

If no catalog is provided, :unresolved_ref checks are skipped.

Conformance

Vendored from gymbile/wpl@v1.1.1. All conformance fixtures pass.

License

Apache-2.0.

"WPL" and "Wellness Plan Language" are trademarks of Gymbile.