Currently we use the "Source" fragment in the target template to map external IDs to C8Y, when enabled in the mapping.
The source fragment is actually reserved for the "internal C8Y ID" which is generated when a document is created.
This was working fine because the mappings are only executed by the mapper microservice who can exchange the mapped ID to source to an external ID. When mappings should be used somewhere else like thin-edge this approach is conflicting.
Suggestion:
Add a new fragment to all the target templates:
"externalSource":{"externalId":"Device4711","type":"c8y_Serial"}
This is also used by thin-edge.io already.
Map external IDs to that new fragment. Keep source in the template but use it for internal ID mappings.
This is a breaking change as we change the mapping data model, but we could provide a script to migrate.
Currently we use the "Source" fragment in the target template to map external IDs to C8Y, when enabled in the mapping. The source fragment is actually reserved for the "internal C8Y ID" which is generated when a document is created. This was working fine because the mappings are only executed by the mapper microservice who can exchange the mapped ID to source to an external ID. When mappings should be used somewhere else like thin-edge this approach is conflicting.
Suggestion: Add a new fragment to all the target templates:
"externalSource":{"externalId":"Device4711","type":"c8y_Serial"}
This is also used by thin-edge.io already.Map external IDs to that new fragment. Keep source in the template but use it for internal ID mappings.
This is a breaking change as we change the mapping data model, but we could provide a script to migrate.