Add ObjectData json type and UNKNOWN enum sentinels to objects spec#495
Open
sacOO7 wants to merge 1 commit into
Open
Add ObjectData json type and UNKNOWN enum sentinels to objects spec#495sacOO7 wants to merge 1 commit into
sacOO7 wants to merge 1 commit into
Conversation
d85dcf3 to
a829907
Compare
Extend the LiveObjects wire types in features.md: - OD2g: add a `json` value field to `ObjectData`, holding a JSON object or array leaf value, sent/received as a JSON-encoded string over the JSON protocol. Update OD2c-OD2f so `json` is listed among the mutually-exclusive value fields, and add the field to the IDL. - OD3a / OD3g: include `json` in the `ObjectData` size calculation; its size is the byte length of its JSON-encoded string representation. This matches both reference implementations (ably-js _getObjectDataSize and ably-java ObjectData.size()). - OOP2a / OMP2a: add a client-side `UNKNOWN` sentinel to the `ObjectOperationAction` and `ObjectsMapSemantics` enums. It has no wire value and is never encoded or sent; decoding an unrecognised action or semantics value yields `UNKNOWN` instead of failing, giving clients a defined way to detect and safely ignore operations they do not understand (e.g. introduced by a newer protocol version). Reflected in the IDL. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
a829907 to
5ddc271
Compare
ttypic
requested changes
Jun 19, 2026
|
|
||
| - `(OOP1)` An `ObjectOperation` describes an operation to be applied to an object on a channel | ||
| - `(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` | ||
| - `(OOP2a)` The enum additionally has an `UNKNOWN` value, which has no wire representation. When decoding, an `action` that does not map to any of the wire-ordered members above must be decoded as `UNKNOWN` rather than failing. The client library must never encode or send `UNKNOWN`, and must ignore (not apply) any `ObjectOperation` whose `action` is `UNKNOWN` |
Contributor
There was a problem hiding this comment.
I think it can be implemented differently (for example, as a nullable field). The main point is that if we receive an unknown value, we shouldn’t fail. Anyway, we agreed that we don’t want to add spec points that contradict the js implementation.
| - `(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 | ||
| - `(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 | ||
| - `(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 | ||
| - `(OD2c)` `boolean` boolean - a primitive boolean leaf value in the object graph. Only one of the value fields - `boolean`, `bytes`, `number`, `string` or `json` - must be set at a time |
Contributor
There was a problem hiding this comment.
weird, don't see any changes to the (OD2c-f), if it's just trailing spaces could we revert them to keep the git history cleaner?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the LiveObjects wire types in
features.mdwith a newjsonvalue type forObjectData, plusUNKNOWNforward-compatibility sentinels on two wire enums.Changes
ObjectData.jsonvalue field (OD2g)jsonfield holding a JSON object or array leaf value in the object graph.OD2c–OD2fupdated sojsonis included in the set of mutually-exclusive value fields (boolean,bytes,number,string,json).json: String?.ObjectDatasize calculation (OD3a,OD3g)OD3aupdated to includejsonin the summed properties.OD3g: the size of ajsonproperty is the byte length of its JSON-encoded string representation._getObjectDataSize→dataSizeBytes(data.json); ably-javaObjectData.size()→json.toString().byteSize).UNKNOWNenum sentinels (OOP2a,OMP2a)UNKNOWNvalue to bothObjectOperationActionandObjectsMapSemantics.action/semanticsvalue that doesn't map to a known member must decode toUNKNOWNrather than failing.ObjectOperationwith anUNKNOWNaction can be safely ignored and not applied.Validation
npm run lint) — no duplicate spec IDs.🤖 Generated with Claude Code