Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface PartialJSON

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.

since

6.2

Hierarchy

Index

Methods

Methods

and

  • Returns a composed constraint that represents a logical AND of this constraint and another.

    If the composed constraint would be unsatisfiable, an Error is thrown.

    Parameters

    • other: UpdateConstraint

      a constraint that will be logically-ANDed with this constraint

    Returns UpdateConstraint

    a composed constraint that represents a logical AND of this constraint and the other constraint

with

  • 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

    • pointer: string

      the pointer expression

    • value: any

      the value

    • Optional dataType: DataType<any, any, any>

      the optional type of the value

    Returns PartialJSON

    a new constraint

without

  • 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

    • pointer: string

      the pointer expression

    Returns PartialJSON

    a new constraint