Skip to content

MDR: name-based portable export serializer (export -> import round-trip) #1008

Description

@bjagg

Describe the issue

POST /import/ (import_datamodel) consumes a name-based ImportDataModelDTO — references between entities/attributes/value-sets/constraints are expressed as names, the portable identity that survives across installs. But GET /export/{id} (export_datamodel) emits ID-based DTOs whose cross-row references are the source database's primary keys (DB artifacts that are meaningless in another install). So the export output cannot be fed back into import — the documented round-trip never actually worked.

(Separately, get_export_dto passed a non-existent check_base kwarg to get_list_of_entities_for_data_model / get_entity_associations_by_data_model_id, so the export path itself raised TypeError before returning anything.)

Proposed solution

Add a serializer that converts the ID-based export into the name-based ImportDataModelDTO:

  • rewrite every cross-row reference (EntityId, AttributeId, ValueSetId, ParentEntityId/ChildEntityId, constraint ElementId, attribute→owning-entity via the entity/attribute association) as the referenced row's name;
  • drop source-DB artifacts (row ids, BaseDataModelId, value OriginalValueId);
  • expose it as GET /export/portable/{id} returning a payload ready to POST straight back to /import/.

Scope: single data model (SourceSchema / standalone). OrgLIF/PartnerLIF extended models spanning a base model, and transformations (#771), are follow-ups.

Depends on #668 (the import-side fixes) for the round-trip to run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions