-
Notifications
You must be signed in to change notification settings - Fork 0
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
Patching entities: Temporary and permanent IDs #20
Comments
My implementation of these concepts is steadily progressing. I've settled on prefixing permanent IDs with
|
Regarding my progress, I have client-to-server sync working. The client tracks changes and packages them into an "Entity JSON Patch" document, that the server then translates into MongoDB's update syntax. I'm now testing peer-to-peer sync. It involves patching in-memory objects rather than the database. In the process of implementation, I've further clarified the syntax described above:
|
My framework has a website: |
I use JSON Patch for persistent object models where collections are unordered sets rather than lists. It's a common scenario, so let's standardize this specialized behavior. I want to help craft an "Entity JSON Patch" RFC. It would be based on the JSON Patch RFC but with key differences. Collections have no order and are instead indexed by ID.
I described how to use permanent IDs in paths at #12 (comment). As for
add
orreplace
operations, thevalue
can be a permanent ID. The applied new value is the existing object indicated by that ID.In issue #5, @briancavalier "raises the problem of server-assigned ids: how can a client submit a patch to add an item where the object key is supposed to be an id that needs to be assigned by the server?" For
add
orreplace
operations that create a new value, thevalue
is of the form "MyNamespace.MyType/$1". This consists of the type of object to create, followed by a/
separator, followed by the temporary ID. The temporary ID consists of a "$" followed by a number that's incremented for each new temporary ID. The temporary ID is thereafter used to reference the new object throughout the scope of the patch document transaction. it can be used in the same ways that permanent IDs can be used.The text was updated successfully, but these errors were encountered: