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.

IF the equity of the person is LESS than 30000
THEN the loan may not be grantedF 
IF the company's location IS NOT in Munich
THEN business is getting harder

Alternative rule expressions

Alternative expressions are containing the indicator-keywords. The condition is an implicit negation.

the applicants age HAS NOT to be LESSER than 18
the applicants age HAS to be AT LEAST 18
the persons location SHOULD be germany

Implicit condition

You can use implicit conditions for boolean expressions .

the contract HAS to be signed

Multiple conditions

AND

  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
     the applicant's age SHOULD NOT BE LESS than 25 years old
 AND his profession MUST be a consultant
    the applicant's degree MUST be a Bachelor
AND his age MUST be at LEAST 25 years

OR

  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
   the applicant's degree MUST be a Bachelor
OR his professional experience MUST be at LEAST 5 years

Complex condition

You have to pay attention to indents for complex conditions

  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

Arithmetic examples

professional experience from age - 18 years MUST NOT be LESS than 10 years
   IF assets - liabilities NOT EQUAL 0 
 THEN the balance must always be balanced
  IF equity / total assets NOT SAME equity ratio
THEN the balance sheet contains errors 

String operations are not possible at the moment

Variables

Numeric values

   42
AS answer to everything

Strings

   Validaria
AS helpful

Boolean expressions

   the age of the applicant is LESS than 18 years old
AS underage

Arithmetic expressions

   age - 18
AS professional experience

Comments

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

OpenAPI

OpenVALIDATION ships a OpenAPI plugin, which defines the validationrules for the serviceoperations.

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   

Last updated