Closed janhicken closed 1 year ago
Hi @janhicken, thank you for providing the fix. Could you extend the test cases for the new case? Besides making sure the new feature works also in the future it would also be a documentation for how to use the new option. And one more question, do we need to take care of the deserialization from json to map to the correct indexed properties?
I added some test cases, that show an exemplary usage of the new feature.
I'm afraid I don't understand what you mean exactly with the indexed property question, could you elaborate?
Nevermind my question, I just missed your description in the PR. The serialized json is using the internal names with the option deactivated and thus can be directly deserialzed and with the option enabled only one property is created.
Thank you for the contribution!
The new
OPTION_USE_NAMES_FROM_EXTENDED_META_DATA
feature allows to configure, if property names should be extracted fromExtendedMetaData
annotations.It is enabled by default to maintain current behaviour.
When dealing with XML and Ecore models, that are generated from an XML schema definition (XSD), the following example can occcur:
Here, the element
<foo>
has both an attribute as well as a child element calledbar
. A derived Ecore model would have two features, where of those has a counter appended to remove ambiguity:The JSON mapper, however, will only serialize one of the two features listed above, because it does not resolve the ambiguity of feature names.
By disabling the newly introduced option, the internal feature names would be used instead.
This fixes https://github.com/eclipse-emfcloud/emfjson-jackson/issues/54