-
Notifications
You must be signed in to change notification settings - Fork 46
Update LiveObjects REST API docs for V2 format and improve structure #3119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Can only be merged (released) after w/c 19th Jan release has completed. |
|
Thanks Zak, we discussed in Slack but sharing my comments here for posterity: While I appreciate the intention behind introducing simple topics before complex ones, I would prefer to keep related content together in single sections. As a reader, I want to find everything about a topic (simple to complex) in one place rather than navigating to multiple sections. Readers aren't reading the entire doc top-to-bottom, instead they're using the sidebar to jump to relevant sections, so I think all related information should be findable in one logical place. However, I agree with the principle of progressive disclosure of complexity, but within the context of individual sections. I think applying this at the document-level makes more sense for "getting started" content or "guides" which have a top-to-bottom narrative flow. Specific suggestions:
|
030b251 to
0a5b328
Compare
mschristensen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just misc. small suggestions, approving ahead of that
| The key in the `data` object indicates the type of the value: | ||
| | Format | Query parameter | Description | | ||
| |--------|----------------|-------------| | ||
| | **Compact** (default) | None | Logical structure without metadata. Ideal for reading data values. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the term "logical structure", I'm not sure this is an accurate description. How about something like "values-only representation" or "values-only serialization?
| </Code> | ||
|
|
||
| #### Get the entire object with metadata <a id="fetching-object"/> | ||
| This example shows a `LiveMap` "votes" stored on the channel object containing two `LiveCounter` instances: "down" and "up". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| This example shows a `LiveMap` "votes" stored on the channel object containing two `LiveCounter` instances: "down" and "up". | |
| This example shows a `LiveMap` stored on the "votes" key of the channel object, which contains two `LiveCounter` instances on the "down" and "up" keys. |
|
|
||
| For example, if you create a cycle in the channel object by adding a reference to the root object in the `votes` `LiveMap` instance with the following operation: | ||
| Each operation includes: | ||
| 1. A reference to an object using either **objectId** or **path** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 1. A reference to an object using either **objectId** or **path** | |
| 1. A reference to an object using either `objectId` or `path` |
| | `mapCreate` | Creates a new LiveMap instance. | | ||
| | `counterCreate` | Creates a new LiveCounter instance. | | ||
|
|
||
| To create an object, see the section on [Creating Objects](#creating-objects). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| To create an object, see the section on [Creating Objects](#creating-objects). | |
| To create an object, see [Creating Objects](#creating-objects). |
|
|
||
| To create an object, see the section on [Creating Objects](#creating-objects). | ||
|
|
||
| <Aside data-type='further-reading'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this belong here, as it applies to the complete API, so I think we should move this to the top
| The request body is of the form: | ||
| Optionally omit the `path` or `objectId` fields when creating an object with `mapCreate`. | ||
| For the object to be reachable in the state tree, assign it to a key in a LiveMap that is | ||
| reachable from the root. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| reachable from the root. | |
| reachable from the channel object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I think we prefer to not introduce our own line breaks in the markdown, instead you can toggle word wrap in your editor if needed
| For the object to be reachable in the state tree, assign it to a key in a LiveMap that is | ||
| reachable from the root. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
| For example, given the following compact view of the channel object: | ||
| Paths are expressed relative to the structure of the object as defined by the [compact](#fetch-channel-object) view of the channel object. | ||
|
|
||
| The following example increments the `LiveCounter` instance stored at the `up` key on the `votes` `LiveMap` object: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should review this page to ensure consistent use of backticks/links around LiveMap/LiveCounter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be a bit verbose to be linking every single LiveMap / LiveCounter. They are linked on the occurrences of those terms. But I can check that the backticks are consistent.
| "operation": "MAP_REMOVE", | ||
| "objectId": "root", | ||
| "data": {"key": "posts"} | ||
| "objectId": "map:abc123@ts1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To illustrate this point, can we update the abc123 to reflect the actual hash you would get from the specified nonce and initial value?
|
|
||
| ## Object reachability and garbage collection <a id="object-reachability"/> | ||
|
|
||
| Objects must be reachable from the channel object to persist. An object is reachable if it can be accessed by traversing keys starting from the channel object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the phrasing "to persist" here might risk incorrect association with persistence i.e. to disk. How about "to avoid being garbage collected" (or perhaps invert the sentence, i.e. "Objects that are not reachable from the channel object will be garbage collected").
The LiveObjects REST API moved from V1 (generic "operation" + "data" fields) to V2 (operation-specific fields: mapSet, counterInc, etc.). Content changes: - Updated the content to match the new V2 API. - Removed the deprecated docs from the open api spec - Added the new V2 api to the open api spec pages. - Added examples of each of the v2 operation types json Structural improvements: - Reorganized the sections into beginner -> advanced flow. - Added or updated header anchors Quality fixes: - Standardized field ordering (objectId/path before operation fields) - Reduced some verbosity, and moved some less relevant data lower in the document.
- Merge fetch sections into unified "Fetching objects" with format comparison - Move path operations and removing objects into "Publishing operations" - Move client-generated IDs into "Creating objects" as subsection - Replace "root object" with "channel object" in descriptions - Add cross-links to LiveMap, LiveCounter, PathObject, Instance docs - Remove "Advanced" prefixes from section headers
bf1ce74 to
9d9118b
Compare
The LiveObjects REST API moved from V1 (generic "operation" + "data" fields) to V2 (operation-specific fields: mapSet, counterInc, etc.).
Content changes:
Structural improvements:
Quality fixes: