Skip to content

Commit de9927d

Browse files
committed
feat: populate important legacy data fields and unset MSSDK ones
Keeping both model fields around during the transition will prevent the resulting documents from being committed into the database, as they will exceed the 16MB BSON document limit of MongoDB. The test data field is highly custom to the pipeline and ingrained in the test code. It is a flat list as compared to the nicely structured one in the MSSDK. We missed to include its cloning in the initial post-model validation function.
1 parent f0e5c06 commit de9927d

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/ted_sws/core/model/transform.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from mapping_suite_sdk.core.models.file_asset import (
2828
RMLMappingFileAsset,
2929
VocabularyMappingFileAsset,
30+
TestDataFileAsset,
3031
)
3132
from mapping_suite_sdk.mapping_package_v2.models.mapping_package_v2_metadata import (
3233
MappingPackageV2Metadata,
@@ -369,3 +370,23 @@ def _populate_legacy_from_mssdk(self) -> None:
369370
resources=resources,
370371
rml_mapping_rules=rml_rules
371372
)
373+
# Clear MSSDK v2 technical and vocabulary suites after populating
374+
self.technical_mapping_suite = None
375+
self.vocabulary_mapping_suite = None
376+
377+
# Populate transformation_test_data from test_data_suites
378+
if (self.transformation_test_data is None or not getattr(self.transformation_test_data, 'test_data', None)) and self.test_data_suites:
379+
all_files = []
380+
for suite in self.test_data_suites:
381+
all_files.extend([
382+
FileResource(
383+
file_name=file.path.name,
384+
file_content=file.content,
385+
original_name=file.path.name
386+
) for file in suite.files if isinstance(file, TestDataFileAsset)
387+
])
388+
self.transformation_test_data = TransformationTestData(
389+
test_data=all_files
390+
)
391+
# Clear MSSDK v2 test_data_suites after populating
392+
self.test_data_suites = []

0 commit comments

Comments
 (0)