eclipse-emfcloud / emfcloud-modelserver

Modelserver component
Other
40 stars 21 forks source link

API v2: Subscription option for URI fragments in update notifications #205

Closed cdamus closed 2 years ago

cdamus commented 2 years ago

The new incremental model update notifications in API v2 that provide a description of changes as JSON Patches are great. However, the path of each operation is supplied as a JSON Pointer. For many applications, this is great and convenient for non-EMFish processing of models.

In my Theia application I use UUIDs exclusively in my EMF resources because in editing scenarios the default path-based URI fragments can change radically even for objects that are not otherwise affected by an edit operation. And throughout the application, various components keep track of objects by their IDs, which being UUIDs are stable. And all of these components have information only about the specific objects that they track ("selections", such as in a Properties view). They do not have the whole model in which the JSON Pointers in patches can be resolved relative to the model root object to find the objects that were changed.

This makes it difficult in a component of my application that is subscribed to model updates to detect when an update includes changes in the "selection" in that component. It would be very easy if the operations in the patch referenced objects not by JSON Pointer but by the "custom path" that the Model Server supports in patches sent in /api/v2/models PATCH requests. That "custom path" being the object's URI fragment plus the feature and optional index.

So, this feature request asks for a new subscription option that instructs the server to provide JSON Patches in which the operations' path properties are URI-fragment-based paths and not standard JSON Pointers. I propose a new URL query parameter paths with two recognized case-insensitive values: