Skip to content
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

API V2: Add support for Json Patch 'test' operations #178

Open
CamilleLetavernier opened this issue Mar 2, 2022 · 1 comment
Open

API V2: Add support for Json Patch 'test' operations #178

CamilleLetavernier opened this issue Mar 2, 2022 · 1 comment
Labels
enhancement New feature or request modelserver EMF.cloud Model Server v2

Comments

@CamilleLetavernier
Copy link
Member

Follow-up for PR #151

At the moment, we support a subset of the Json Patch standard (Add, Replace and Remove operations), as each operation needs to be carefully translated to an equivalent EMF Command.

The Json Patch standard also defines a 'test' operation, to make sure we're applying the patch on a consistent version of a model. We should add support for this 'test' operation in the Model Server, and reject the edit request for the entire patch if a test operation is not valid.

@CamilleLetavernier CamilleLetavernier added enhancement New feature or request modelserver EMF.cloud Model Server labels Mar 2, 2022
@CamilleLetavernier
Copy link
Member Author

In general, it would also be interesting to have a "version" attribute for models, since the EMF.Cloud architecture is inherently asynchronous. At the moment, patches can be instantiated on the client side on an older version of the model, while a command is being processed, which could lead to unexpected results (Either a patch would not apply at all, or would apply in an inconsistent way).

For simple editions, like modifying attributes, this isn't an issue; but for more complex commands (Manipulating entire sub-trees or cross-references), 'test' operations might not be sufficient to ensure model consistency. With a generic version attribute on the model, we could 'test' for a specific version of the model before applying the patch.

This attribute also doesn't need to exist in the EMF Model: it can probably be derived as part of the Json Model generation, as an additional metadata attribute (e.g. $version). In this case, the ModelServer would only need to keep the current version in memory, without actually persisting it; and it would work with any model.

@ndoschek ndoschek added the v2 label Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request modelserver EMF.cloud Model Server v2
Projects
None yet
Development

No branches or pull requests

2 participants