Closed nestabentum closed 4 months ago
@nestabentum Thank you for your interest in this project. I'll try to have a look at this soon as I'm also not fully sure why those restrictions are in place. In theory, with the EcoreTypeInfo
we should be able to properly determine the type in any case. I'll let you know as soon as I find out more.
Hi, are there any updates on this issue?
@nestabentum Thank you for following up! I didn't have as much time as I'd hoped to go deeper, unfortunately. From a first glance, we should be able to fix this and I don't know why the restriction was implemented in the first place. I'll do a deep dive on Monday and come back to you then.
@nestabentum I had a deeper look at the issue and it seems that the condition was added to minimize "unnecessary" type information (see https://github.com/emfjson/emfjson-jackson/issues/93 and the two related commits). I assume the rationale behind it is that if you know the type of the root node you can derive the types of the other nodes based on the metamodel, so you could skip that during serialization. However, in cases such as yours, we still want to have that information.
To not break backwards compatibility, I'd suggest to add a dedicated option to turn off the minimization, see https://github.com/eclipse-emfcloud/emfjson-jackson/pull/65. Could you please check whether you think that will solve the issue for you as well?
Looks good to me!
I'm trying to build an EMF modeling tool by customizing the Coffee Editor. Currently, my goal is to implement the Tree Editor as meta-model agnostic as possible. To achieve this, I realized that type information must be serialized by the model server. Unfortunately, there seems to be a bug that prevents the type information from being serialized.
I modified the
CoffeTreeJsonCodec
in the Coffee Editor by addingemfModule.configure(EMFModule.Feature.OPTION_SERIALIZE_TYPE, true);
- unfortunately this does not have an effect. (The comment in this class already suggests so:// FIXME investigate why eClass (type) is not serialized for nested elements // e.g. processor child of control unit
). With debugging, I was able I was able to identify the methodEObjectTypeProperty#serialize
as problematic. It only writes the type information when the corresponding EObject is the root orobjectType != featureType && objectType != EcorePackage.Literals.EOBJECT
.As a user of the EMFModule I would expect type information to be serialized when using the corresponding action, regardless of further constraints. Are there any plans to fix this? Are there known workarounds?