Returns a composed constraint that represents a logical AND of this constraint and another.
a constraint that will be logically-ANDed with this constraint
a composed constraint that represents a logical AND of this
constraint and the other
constraint
Returns a composed constraint that represents a logical OR of this constraint and another.
a constraint that will be logically-ORed with this constraint
a composed constraint that represents a logical OR of this
constraint and the other
constraint
Require a value at a specific position in the JSON object.
This is equivalent to calling with(String, Operator, Object) with an operator of IS.
the pointer expression
the value
the optional type of the value
a new constraint
Compares a location within the JSON topic value to a specified value.
If there is no value found at the specified pointer position, the constraint will be unsatisfied.
If a String value is supplied and the operator is EQ or NE, the string representation of the topic value at the given pointer will be compared to the supplied value. If the value at the pointer position is not a string or number the constraint will be unsatisfied. Other operators (other than IS) are not permitted with String values.
If a number value (Int64 or Double) is supplied the value will be compared with the number value at the topic location. This will work with JSON string or number values only. JSON strings can only be compared if they contain a value that can be parsed as a number. If a string value at the location cannot be parsed as a number, the constraint will be unsatisfied. Any of the operators (other than IS) can be used with such number comparisons. Decimal numbers can be compared with integral numbers so {@code 1} is equal to {@code 1.0}, {@code "1"}, or {@code "1.0"}.
If a {@code null} value is supplied and the operator is EQ or NE, the topic value at the given pointer will be compared to JSON null. Other operators (other than IS) are not permitted with a {@code null} value.
If a boolean
value is supplied and the operator is
EQ, the topic value at the given pointer will be
compared to the boolean value. Other operators are not permitted with
a boolean value.
If the IS operator is specified the supplied value will be compared to the topic value for strict binary equality. In this case the value must be of type String, Int64, Double, Bytes, or {@code null}. This is slightly more efficient than the lenient comparisons described above.
a JSON Pointer specifying the location of the {@code value} in the JSON object.
the value
the operator that determines the type of comparison
a new constraint
Require a specific position in the JSON object to be empty.
The pointer
is a
JSON Pointer syntax
reference that should have no value in the JSON object. If the
pointer
parameter cannot be parsed as a JSON pointer an
Error
is thrown.
The function returns a new PartialJSON object. The original object remains unmodified.
the pointer expression
a new constraint
A constraint requiring the current value of the JSON topic to match the partially described value.
The code:
const factory = diffusion.updateConstraints(); const constraint = factory.jsonValue().with('/id', idValue).without('/cancellation');
creates a constraint for a JSON object with a specific ID value and no value for a 'cancellation' property.
Missing keys are matched differently to keys that are present with null values.
6.2