eclipse-emfcloud / emfjson-jackson

emfjson-jackson
Other
16 stars 15 forks source link

Mapping FeatureMapEntries to JSON #67

Closed vhemery closed 2 months ago

vhemery commented 3 months ago

Provide a mapping for FeatureMapEntries with JSON. Dedicated Serializer and Deserializer handle the mapping and deserializer has a specific reference entries resolution.

The "Nora'sCaravan" model is a fully functional model which illustrates the problematic and could not be mapped with the old approach.

Note this changes the fragment paths in JsonResource: Since the JSON and XMI paths to elements can not correspond, URI fragment is different in JSON and XMI. This concerns only paths in feature maps, no impact outside of feature maps. (We can not have the same path since JSON does not allow duplicates nor specific properties ordering. So either we have different paths or we are not JSON compatible.) This specific fragment path is handled correctly by the JsonResource implementation.

This mapping comes with two flavors, configurable with the EMFModule.Feature.OPTION_USE_FEATURE_MAP_KEY_AND_VALUE_PROPERTIES option:

Closes https://github.com/eclipse-emfcloud/emfjson-jackson/issues/8

vhemery commented 3 months ago

@martin-fleck-at I don't get why my caravan.xcore's Package class is not generated and found by the tests. Any idea ? (works in Eclipse, but not with Maven)

vhemery commented 3 months ago

@martin-fleck-at I don't get why my caravan.xcore's Package class is not generated and found by the tests. Any idea ? (works in Eclipse, but not with Maven)

Apparently, the use of XML String type was not supported. ¯\_(ツ)_/¯ I wanted to simulate an XSD import, but that's not a big deal. So let's just use ecore String.

martin-fleck-at commented 3 months ago

@vhemery Thank you very much for your PR, I'll have a proper look at it early next week.

martin-fleck-at commented 2 months ago

@vhemery Thank you for the quick update and the great work, everything looks good to me now.