JSONPath is used for defining specifications of relationship checks between attributes that cannot be specified in JSON Schema. The use of JSONPath definitions promotes the creation of unambiguous specifications. JSONPath can be used to check the dependency between two or more data in the AFD JSON message or in the database. The JSONPath expression within the AFD-definition Standard must be a conditional expression in all cases. The expression always returns a true or false result.

A validation rule within AFD-definition Standard is constructed as follows:

1. id: an element containing a rule ID of the validation rule.
2. test: the validation rule written as AFD JSONPath expression.
3. message: an element containing the error message to be displayed if the rule executed returns a Boolean false.
4. source: an element containing documentation on the validation rule.

Function example

Below is an example JSONPath within the AFD-definition Standard for the validation rule ‘If the coverageCode is equal to ‘2002’ or ‘2003’, originalCatalogValue or currentValue must be greater than 0’.

"rule": [
         "id": "JSONPath Verbandscontrole 1",
         "test": "if ((?*?*?coverage?*[?entityType="hullVehicle"])?coverageCode eq "2002" or (?*?*?coverage?*[?entityType="hullVehicle"])?coverageCode eq "2003") 
                  then ((?*?*?object?*[?entityType="motorVehicle"])?originalCatalogValue gt 0.0 or (?*?*?object?*[?entityType="motorVehicle"])?currentValue gt 0.0) else true()",
        "message": "De cataloguswaarde of de dagwaarde van het voertuig moet hoger zijn dan 0 bij volledige of beperkte casco dekking",
        "source": "Handleiding par 2.5"


Thanks for your feedback.

Post your comment on this topic.

Post Comment