Links

Examples

coming soon . . .

Conditions

IF - THEN

OpenValidation defines conditions and actions of each rule with IF - THEN terms. Every rule has to have at least one keyword.
Rule
Schema
IF the equity of the person is LESS than 30000
THEN the loan may not be grantedF
{
equity: 25000
}
Rule
Schema
IF the company's location IS NOT in Munich
THEN business is getting harder
{
location: Dortmund
}

Alternative rule expressions

Alternative expressions are containing the indicator-keywords. The condition is an implicit negation.
Rule
Schema
the applicants age HAS NOT to be LESSER than 18
{
age: 17
}
Rule
Schema
the applicants age HAS to be AT LEAST 18
{
age: 17
}
Rule
Schema
the persons location SHOULD be germany
{
location: iceland
}

Implicit condition

You can use implicit conditions for boolean expressions .
Rule
Schema
the contract HAS to be signed
{
signed: false
}

Multiple conditions

AND

Rule
Schema
IF the age of the applicant is GREATER than 70
AND his residence is NOT Dortmund
THEN You are not allowed to be older than 70 and you must come from Dortmund
{
residence: "Berlin",
age: 18
}
Rule
Schema
the applicant's age SHOULD NOT BE LESS than 25 years old
AND his profession MUST be a consultant
{
profession: "Developer",
age: 18
}
Rule
Schema
the applicant's degree MUST be a Bachelor
AND his age MUST be at LEAST 25 years
{
age: 24,
degree: "Master"
}

OR

Rule
Schema
IF the degree of applicant IS NOT Bachelor
OR his professional experience is LESS than 5 years
THEN you must have a bachelor's degree or 5 years experience
{
experience: 6,
degree: "Master"
}
Rule
Schema
the applicant's degree MUST be a Bachelor
OR his professional experience MUST be at LEAST 5 years
{
experience: 6,
degree: ""
}

Complex condition

You have to pay attention to indents for complex conditions
Rule
Schema
IF the place of residence of the person IS London
AND the name of the person EQUALS Mycroft Holmes.
OR his name EQUALS Sherlock Holmes.
THEN the person is a genius
{
residence: "London",
name: "Sherlock Holmes"
}

Arithmetic examples

Rule
Schema
professional experience from age - 18 years MUST NOT be LESS than 10 years
{
age: 25
}
Rule
Schema
IF assets - liabilities NOT EQUAL 0
THEN the balance must always be balanced
{
assets: 1,
liabilties: 2
}
Rule
Schema
IF equity / total assets NOT SAME equity ratio
THEN the balance sheet contains errors
{
assets: 100,
equity: 25
}
String operations are not possible at the moment

Variables

Numeric values
Variable definition
42
AS answer to everything
Strings
Variable definition
Validaria
AS helpful
Boolean expressions
Variable definition
the age of the applicant is LESS than 18 years old
AS underage
Arithmetic expressions
Variable definition
age - 18
AS professional experience

Comments

comment
COMMENT This is a commentary
comment
COMMENT Multi-line comments
are also possible

OpenAPI

OpenVALIDATION ships a OpenAPI plugin, which defines the validationrules for the serviceoperations.
oapi.spec.yaml
Download
openapi: "3.0.0"
info:
version: 1.0.0
title: openVALIDATION
description: openVALIDATION Beispiele.
paths:
/:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/person'
x-ov-rules:
culture: en
rule: |
COMMENT This is a comment, Miss Honey
IF the persons equity is LESS THAN 30000
THEN a loan could not be granted
responses:
'200':
description: success
components:
schemas:
person:
type: object
properties:
equity:
type: integer
oapi.spec.yaml
764B
Code
oapi.spec.yaml