OpenUI.Runtime.Validation (OpenUI v0.1.1)

Copy Markdown View Source

Field validation rules (language.md, section 5.4): required, email, url, numeric, minLength, maxLength, min, max and pattern.

Rules run in that fixed order, since an evaluated rules object carries no key order, and the first failing rule names the error. Every rule except required skips empty values. Unknown rules are ignored.

Summary

Functions

Checks value against rules; returns {:error, rule} for the first rule that fails.

Functions

validate(value, rules)

@spec validate(term(), map()) :: :ok | {:error, String.t()}

Checks value against rules; returns {:error, rule} for the first rule that fails.