-
Notifications
You must be signed in to change notification settings - Fork 8
Description
- Create an AddCommand with one of the constructors of class
emfcloud-modelserver-theia/packages/modelserver-client/src/model/command-model.ts
Line 99 in 1c8e537
export class AddCommand extends ModelServerCommand { - Then, try and insert it in a CompoundCommand with constructor of
emfcloud-modelserver-theia/packages/modelserver-client/src/model/command-model.ts
Line 55 in 1c8e537
export class CompoundCommand extends ModelServerCommand { - When the command is sent to the model server, the model server will try and fail at resolving the references for
#objectValuesin methodorg.eclipse.emfcloud.jackson.databind.deser.ReferenceEntry.Base.resolve(DatabindContext, URIHandler).
The cause is that the following line :
emfcloud-modelserver-theia/packages/modelserver-client/src/model/command-model.ts
Line 116 in 1c8e537
| (o, i) => new ModelServerReferenceDescription(o.eClass, `//@objectsToAdd.${i}`) |
assigns the
#objectValues, assuming that the command is the resource's root, with an absolute URI.
In my particular use case, where command was at index 1 (2nd), post-treating the references like this did the trick :
addCommand.objectValues?.forEach(v => {
v.$ref = v.$ref.replace('//@objectsToAdd.', '//@commands.1/@objectsToAdd.');
});
but this fix is too specific to my use case.
In the general case, the AddCommand constructor can't possibly know where the command will be located in the resource. So I'm not sure what the best fix would be.
Possibilities I can think of :
- Force the user to indicate where the command will be located, so that we directly insert the correct model reference.
- Patching references automatically :
- leave the constructor as is, with a big shouting warning that the reference may be incorrect
- when constructing the CompoundCommand, patching all the model references in contained commands to prepend with the command uri (and also a big shouting warning)
- A kind of mix, with the possibility to use relative uri fragments or placeholders, which will be patched later...
Not sure which approach is the best.