Skip to content

Introduction ​

LIVR (Language Independent Validation Rules) is a specification for describing data validation rules as plain data. You write the rules once, as a structure that looks like the data it validates, and any LIVR implementation, in any language, validates the data the same way:

  • it returns only the fields that have rules, so everything else is dropped;
  • it reports errors for all fields at once, as readable codes shaped like your data;
  • it can also clean the data on the way: trim strings, lowercase emails, set defaults.
Live example · edit rules or inputOpen in playground
rules
input
Invaliderrors
{
  "name": "REQUIRED",
  "email": "WRONG_EMAIL",
  "age": "TOO_LOW"
}

Because the rules are data, you can store them in JSON, send them from the server to the browser, and use the same schema in services written in different languages. The specification includes a test suite that every implementation runs, so they all behave the same way.

Where to go next ​

Articles and talks ​