-
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 |
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 */