Skip to content

Commit 6dc3ac9

Browse files
authored
Merge pull request #495 from ably/fix/liveobjects-spec-objectdata-json-type
Add ObjectData json type and UNKNOWN enum sentinels to objects spec
2 parents 8a8fbff + ce1bc3c commit 6dc3ac9

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

specifications/features.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,7 @@ The core SDK provides an API for wrapper SDKs to supply Ably with analytics info
13121312

13131313
- `(OOP1)` An `ObjectOperation` describes an operation to be applied to an object on a channel
13141314
- `(OOP2)` `ObjectOperationAction` enum has the following values in order from zero: `MAP_CREATE`, `MAP_SET`, `MAP_REMOVE`, `COUNTER_CREATE`, `COUNTER_INC`, `OBJECT_DELETE`, `MAP_CLEAR`
1315+
- `(OOP2a)` When decoding, an `action` that does not map to any of the wire-ordered members above must not cause decoding to fail. The client library must instead represent it as an unrecognised action, using whatever representation is idiomatic for the implementation (for example a distinct sentinel value or a nullable field). The client library must never encode or send such an unrecognised action, and must ignore (not apply) any `ObjectOperation` whose `action` is unrecognised
13151316
- `(OOP3)` The attributes available in an `ObjectOperation` are:
13161317
- `(OOP3a)` `action` `ObjectOperationAction` enum - defines the operation to be applied to the object
13171318
- `(OOP3b)` `objectId` string - the object ID of the object on a channel to which the operation should be applied
@@ -1475,6 +1476,7 @@ The core SDK provides an API for wrapper SDKs to supply Ably with analytics info
14751476

14761477
- `(OMP1)` An `ObjectsMap` object represents a map of key-value pairs
14771478
- `(OMP2)` `ObjectsMapSemantics` enum has the following values in order from zero: `LWW`
1479+
- `(OMP2a)` When decoding, a `semantics` value that does not map to any of the wire-ordered members above must not cause decoding to fail. The client library must instead represent it as unrecognised semantics, using whatever representation is idiomatic for the implementation (for example a distinct sentinel value or a nullable field), and must never encode or send such an unrecognised value
14781480
- `(OMP3)` The attributes available in an `ObjectsMap` are:
14791481
- `(OMP3a)` `semantics` `ObjectsMapSemantics` enum - the conflict-resolution semantics used by the map object
14801482
- `(OMP3b)` `entries` `Dict<String, ObjectsMapEntry>` - the map entries, indexed by key
@@ -1510,19 +1512,21 @@ The core SDK provides an API for wrapper SDKs to supply Ably with analytics info
15101512
#### ObjectData
15111513

15121514
- `(OD1)` An `ObjectData` represents a value in an object on a channel
1513-
- `(OD2)` The attributes available in an `ObjectData` are:
1515+
- `(OD2)` The attributes available in an `ObjectData` are listed below. Of the value fields - `boolean`, `bytes`, `number`, `string` and `json` - at most one must be set at a time:
15141516
- `(OD2a)` `objectId` string - a reference to another object
15151517
- `(OD2b)` `encoding` string - may be set by the client library to indicate that value in `string` field have an encoding
1516-
- `(OD2c)` `boolean` boolean - a primitive boolean leaf value in the object graph. Only one of the value fields - `boolean`, `bytes`, `number` or `string` - must be set at a time
1517-
- `(OD2d)` `bytes` binary \| string - a primitive binary leaf value in the object graph. It is sent to and received from the server as a Base64-encoded string when using the JSON protocol. Only one of the value fields - `boolean`, `bytes`, `number` or `string` - must be set at a time
1518-
- `(OD2e)` `number` number - a primitive number leaf value in the object graph. Only one of the value fields - `boolean`, `bytes`, `number` or `string` - must be set at a time
1519-
- `(OD2f)` `string` string - a primitive string leaf value in the object graph. Only one of the value fields - `boolean`, `bytes`, `number` or `string` - must be set at a time
1518+
- `(OD2c)` `boolean` boolean - a primitive boolean leaf value in the object graph
1519+
- `(OD2d)` `bytes` binary \| string - a primitive binary leaf value in the object graph. It is sent to and received from the server as a Base64-encoded string when using the JSON protocol
1520+
- `(OD2e)` `number` number - a primitive number leaf value in the object graph
1521+
- `(OD2f)` `string` string - a primitive string leaf value in the object graph
1522+
- `(OD2g)` `json` JsonObject \| JsonArray - a primitive JSON leaf value (an object or array) in the object graph. It is sent to and received from the server as a JSON-encoded string when using the JSON protocol
15201523
- `(OD3)` The size of the `ObjectData` is calculated as follows:
1521-
- `(OD3a)` The size is the sum of the sizes of the `boolean`, `bytes`, `number`, and `string` properties
1524+
- `(OD3a)` The size is the sum of the sizes of the `boolean`, `bytes`, `number`, `string`, and `json` properties
15221525
- `(OD3b)` If set, the size of a `boolean` property is 1
15231526
- `(OD3c)` If set, the size of a `bytes` property is its size in bytes (of the actual binary, not the base64 representation, regardless of whether the binary protocol is in use)
15241527
- `(OD3d)` If set, the size of a `number` property is 8
15251528
- `(OD3e)` If set, the size of a `string` property is its length
1529+
- `(OD3g)` If set, the size of a `json` property is the byte length of its JSON-encoded string representation
15261530
- `(OD3f)` The size of a `null` or omitted property is zero
15271531
- `(OD4)` `ObjectData` encoding:
15281532
- `(OD4a)` Payloads must be booleans, binary, numbers, strings, or JSON-encodable objects or arrays. Any other data type must not be permitted and result in an error with code 40013
@@ -2629,6 +2633,7 @@ Each type, method, and attribute is labelled with the name of one or more clause
26292633
bytes: Binary? | String? // OD2d
26302634
number: Number? // OD2e
26312635
string: String? // OD2f
2636+
json: String? // OD2g
26322637

26332638
class Annotation // TAN*
26342639
+fromEncoded(JsonObject, ChannelOptions?) -> Annotation // TAN3

0 commit comments

Comments
 (0)