Class: PartialJSON

diffusion.topicUpdate. PartialJSON


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 the 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.

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

Type
diffusion.topicUpdate.UpdateConstraint

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 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.

Parameters:
Name Type Description
pointer String

the pointer expression

Returns:

a new constraint

Type
diffusion.topicUpdate.UpdateConstraint