Input validation allows data services to validate the input parameters in a request and stop the execution of the request if the input doesn’t meet the required criteria. The WSO2 Data Services Server provides a set of built-in validators for some of the most common use cases. It also provides an extension mechanism where custom validators can be written. For details on custom validators, refer to the Custom section.
Built-In Input Validators
Given below are the pre-defined, standard validators available in the WSO2 Data Services Server. These validators have to be added to individual input mappings in a query.
Follow the instructions below to begin.
1) Click Add New Query in the Queries page.
The Queries page appears when creating a Data Service. For information on opening the Queries page, refer to section: Create a Data Service Using Various Data Sources.
In the Add New Query page that appears, provide the QueryID and DataSource. The Input Mappings section opens.
Click the Add New Input Mapping link.
Long Range Validator
Used to validate an integer value and check if it is in the specified range. The validator requires minimum and the maximum values of the range to be validated as shown below: