JMESPath is used for defining specifications of validation rules between attributes that cannot be specified in JSON Schema. The use of JMESPath definitions promotes the creation of unambiguous specifications. JMESPath can be used to check the dependency between two or more data in the AFD JSON message or in the database. The JMESPath 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 JMESPath within the AFD-definition Standard for the validation rule ‘If there is a coverage for entityType hullVehicle, the attribute originalListPrice must be greater than 0’.

"rule": [
    {
      "id": "Validation rule 1",
      "test": "!((policy[].coverage[? entityType == 'hullVehicle'])[] !=`[]`)||((policy[].object[? entityType == 'motorVehicle' && initialListPrice >`0`])[] !=`[]`)",
      "message": "In case of a coverage for hull vehicle the original listprice of the vehicle must be greater than '0'.",
      "source": "Manual par 1.4"
    }
  ]

Feedback

Thanks for your feedback.

Post your comment on this topic.

Please do not use this for support questions.
If you have any support questions, do not hesitate to contact us.

Post Comment