Rule catalog
Therules
array accepts multiple validation criteria:
Validation Rule | Format | Data Types |
---|---|---|
required | boolean (true or false ) | All fields (including arrays and custom objects) |
min & max (on value) | integer or decimal | Numeric data types |
min & max (on length) | integer | String-based types or arrays |
enum | Must match property type | Numeric or string-based types |
pattern | Regex string | String-based types |
Required fields
Marking a property as required enforces that the key must be present and notnull
:
Numeric data types
integer
and decimal
properties can enforce value ranges or enumerations:
String data types
String-based types (symbol
, code
, markdown
, uri
, url
, xhtml
) can combine length, enumeration, and pattern rules:
Clinia evaluates regular expressions using the ECMAScript flavor. Escape backslashes accordingly:
^[\\w\\-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$
.Arrays
You can constrain both the array itself and its items:required
forces the array to be present (it can still be empty).min
/max
target the number of elements.- Nested rules apply to every item in the array.
Objects and complex types
Object properties (customobject
types or Clinia complex types like address
, contactpoint
) only accept required
at the top level. To validate sub-fields, apply rules directly on nested properties:
Next steps:
- Dive into advanced validation to apply conditional logic and cardinality.
- Explore vocabulary binding to enforce controlled terminology.