eclipse-emfcloud / emfcloud-modelserver

Modelserver component
Other
40 stars 21 forks source link

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

Closed cdamus closed 2 years ago

cdamus commented 2 years ago

As described in the feature request, add a new subscription parameter for paths scheme. Now, with the paths=uriFragments query parameter in the /api/v2/subscribe request, the Operations in JSON Patches provided by the server in incremental update notifications will have path properties of the form

#_0uuid6017-fun/feature/3

whereas otherwise they have the form

/path/1/through/3/containment/0/references/7/to/0/a/1/feature/-

Note that the resource URI is not included; only the fragment portion. A future enhancement can include resources URIs when they are necessary either to disambiguate operations on objects in different resources or when the resource URI is different to the modeluri parameter of the subscription. This is for now on par with the JSON Pointer scheme, which also does not support multiple resources (see #159 for more on that).

Also incidentally fix a compiler warning introduced by an earlier PR.

Resolves #205

Contributed on behalf of STMicroelectronics.

cdamus commented 2 years ago

Thanks again @ndoschek. As discussed, commit 0fe3af44ff13015bc4d479ffb7b0844b211b3af8 fixes the problem of the path in the transformed JSON Patch operations not including the resource part of the URI, which doesn't match the kind of patches that the server accepts.

cdamus commented 2 years ago

And commit 68724d88abc49a1319dd12b32c0a97b70f2e8fc8 adds the new subscription option to the V2 client API and also to the example CLI app.

As the number of subscription options is growing, it seems appropriate to add a more generic API to capture them all together in one bundle in one subscription call without further proliferating overloads of the subscribe method signature.

cdamus commented 2 years ago

Good point, @ndoschek . That's now done in commit f2e231f27ed2884c7021a843193afd2fb4f2024e.