ObservableJsonAccess

Namespace: SnowBank.Data.Json · enum

Implements: IComparable, ISpanFormattable, IFormattable, IConvertible

Represents the type of read access to a node in an observable JSON document

Fields

Exists

Exists = 3

Only the presence of the node was used.

The outcome would only change if the node comes from null/missing to non-null, or vice versa.

The associated argument will be true if the node exists, or false if the node does not exist (null or missing) in the original document.

Example: { x: 123 } => { x: null } or => { x: 123 } will change the outcome, but { x: 123 } => { x: 456 } will not.

Length

Length = 2

Only the length of the array, number of field in the object, or length of the string was used.

The outcome would only change if the length of the array would change (added/removed).

The associated argument must be the length of array in the original document, or Missing if the node was missing, or not an array.

Example: { xs: [ 1, 2, 3 ] } => { xs: [ 4, 5, 6 ] } will not change the outcome, but { xs: [ 1, 2, 3 ] } => { xs: [ 1, 2, 3, 4 ] } or { xs: [ 1, 2, 3 ] } => will.

Example: { xs: { "hello": "world" } } => { xs: { "hello": "there" } } will not change the outcome, but { xs: { "hello": "world" } } => { xs: { "hello": "world", "foo": "bar" } } or { xs: { "hello": "world" } } => { xs: null } will.

Example: { xs: { "hello": "world" } } => { xs: { "hello": "there" } } will not change the outcome, but { xs: { "hello": "world" } } => { xs: { "hello": "world!" } } or { xs: { "hello": "world" } } => { xs: { "hello": null } } will.

None

None = 0

The node was not accessed, or it was only traversed to reach any of its children

If the node was traversed to reach a child, it will be recorded by another entry.

The associated argument should be null

For example, in { point: [ 1, 0, 1 ] } => { point: [ 1, 1, 1 ] } the node 'point' was only traversed, and any change in the outcome would be caused by a child, point[1] in this case.

Type

Type = 4

Only the type of the node was used.

The outcome would only change if the type of node would change (including to and from null)

The associated argument will be the integer value of the corresponding JsonType enum

This is more precise than Exists which only differentiate between Null or any other type.

Example: { x: "hello" } => { x: "world" } will not change the outcome, but { x: "hello" } => { x: [ "hello", "there"] } or { x: "hello" } => will.

Value

Value = 1

The content of the node was used.

The outcome could change if the value of the node changes from any value to any other value

The associated argument will be the value of this field in the original document

Example: { x: 123 } => { x: 456 } will change the outcome, but { x: 123 } => { x: 123, y: 456 } will not.