new PartialJSON()
A constraint requiring the current value of the JSON topic to match the partially described value.
The code:
var factory = diffusion.updateConstraints(); var 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.
- Since:
-
- 6.2
Extends
- UpdateConstraint
Methods
-
with(pointer, dataType, value)
-
Require a value at a specific position in the JSON object.
The
pointer
is a JSON Pointer syntax reference locating thevalue
in the JSON object. If thepointer
parameter cannot be parsed as a JSON pointer anError
is thrown.The function returns a new PartialJSON object. The original object remains unmodified.
Parameters:
Name Type Description pointer
String the pointer expression
dataType
diffusion.datatypes.DataType the optional type of the value
value
any the value
Returns:
a new constraint
-
without(pointer)
-
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 thepointer
parameter cannot be parsed as a JSON pointer anError
is thrown.The function returns a new PartialJSON object. The original object remains unmodified.
Parameters:
Name Type Description pointer
String the pointer expression
Returns:
a new constraint