Ready to go in 3 min.
Prerequisites
You need Java version 8 or higher. Here you can download the corresponding JRE 1.8.
1. Installation
You need openvalidation.jar to generate code. openvalidation.jar is a simple Java command line interface. You can download the openvalidation.jar here:
Best you create a new directory under your personal Temp folder and download the openvalidation.jar into this folder:
2. Create a rule
Ok, now you are ready to start and can program your first validation rule in openVALIDATION. Create a file called rules.ov and add the following content:
This rule is formatted so that it best illustrates the keywords and syntax of the openVALIDATION language. You could also just write If the message is Hello then hello openVALIDATION!
and it would work just the same.
In addition to the actual rule, you also need a schema. The schema defines the data structure of the data set to be validated. You can use a simple JSON object from which a JSON schema is automatically derived. Our schema consists only of a text field called "Message".
3. Generate code
Since our validation rule and the corresponding schema are already fixed, we can now generate the corresponding code.
Congratulations! You have just created your first validation rule in JavaScript. This can be found in the file myRules.js. This is the result:
4. Rules integration
Now we'd like to see if our rule works. We create a file called test.html and add the following code:
We call the test.html in the browser and type "Hello" into the input field:
As expected, when entering the value "Hello", our error message appears.
5. No-Code Development
You can now extend the rules by filling the file rules.ov with additional rules and then doing the generation process again using openVALIDATION CLI. Just follow steps 2 to 4.
The nice thing about it is that the file rules.ov can now be edited by a domain expert without having to be familiar with the technology! As soon as he has changed the rules, openVALIDATION can automatically generate program code from them. This is what we call No-Code Development.
If you would like to try out another detailed implementation example, then have a look at the Integration section.
Last updated