-
Notifications
You must be signed in to change notification settings - Fork 0
Rules
Ivan Kouznetsov edited this page Aug 14, 2020
·
3 revisions
JSON rules consist of:
- A JSON path and either a literal value or a rule.
The possible rules are (x, y, z in the rules refer to parameters):
Rule | What it means |
---|---|
is a number | checks if every value that matches the JSON path is a number |
> x | checks if every value that matches the JSON path is a number greater than x |
>= x | checks if every value that matches the JSON path is a number greater than or equal to x |
< x | checks if every value that matches the JSON path is a number less than x |
<= x | checks if every value that matches the JSON path is a number less than or equal to x |
is text | checks if every value that matches the JSON path is text of length 1 or longer |
is text containing x | checks if every value that matches the JSON path is text that contains x |
is text not containing x | checks if every value that matches the JSON path is text that does not contain x |
is any of x y z | checks if every value that matches the JSON path is one of the values |
is not x | checks if every value that matches the JSON path is not x |
matches x | checks if every value that matches the JSON path matches the regular expression x |
count = x | checks if the number of values that matches the JSON path is x |
count > x | checks if the number of values that matches the JSON path is greater than x |
count >= x | checks if the number of values that matches the JSON path is greater than or equal to x |
count > x | checks if the number of values that matches the JSON path is greater than x |
count >= x | checks if the number of values that matches the JSON path is greater than or equal to x |
count < x | checks if the number of values that matches the JSON path is less than x |
count <= x | checks if the number of values that matches the JSON path is less than or equal to x |
each has x | checks if each of values that matches the JSON path is an object with a property called x |
properties limited to x y z | checks if each of values that matches the JSON path is an object the properties of which cannot be anything other than x y or z |
is after x | checks if each of values that matches the JSON path is a date after x |
is as early as x | checks if each of values that matches the JSON path is a date as early as x |
is as late as x | checks if each of values that matches the JSON path is a date up to and including x |
is a date | checks if each of values that matches the JSON path is a date |
is earlier than x | checks if each of values that matches the JSON path is a date earlier than x |
is same date as x | checks if each of values that matches the JSON path is a date with the same year day, month, and day as x |
is same date and time as x | checks if each of values that matches the JSON path is a date with the same year day, month, and day and time as x |
is sorted asc/desc | checks if the values that matches the JSON path are stored in either ascending or descending order, one of the following types is automatically inferred: number, date, string |
Header expectations consist of:
Header name followed by a colon and the expected value or a rule. There is one header rule, it is "must not be present". Examples:
"X-Powered-By":"Express"
"X-Powered-By": must not be present /* will fail if this header is sent */