diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/modelToModelToRelational/milestoned/milestonedSourceToNonMilestonedTargetProperty.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/modelToModelToRelational/milestoned/milestonedSourceToNonMilestonedTargetProperty.pure index b6edde1f7ec..ca4aefb1563 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/modelToModelToRelational/milestoned/milestonedSourceToNonMilestonedTargetProperty.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/modelToModelToRelational/milestoned/milestonedSourceToNonMilestonedTargetProperty.pure @@ -167,6 +167,38 @@ function <> meta::pure::graphFetch::tests::m2m2r::mil ']}', $result); } +function <> meta::pure::graphFetch::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::testFlatten_ViaNoArgMapping_ViaAssociation():Boolean[1] +{ + let mapping = meta::pure::graphFetch::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::getNoArgFlattenMapping_ViaAssociation(); + let runtime = getModelChainRuntime($mapping); + + let query={bdate:DateTime[1]|meta::relational::tests::milestoning::TargetProductFlattened.all($bdate)->graphFetch( + #{ + meta::relational::tests::milestoning::TargetProductFlattened{ + id, + name, + synonymNames + } + }# + )->serialize( + #{ + meta::relational::tests::milestoning::TargetProductFlattened{ + id, + name, + synonymNames + } + }# + ) + ->meta::pure::mapping::from($mapping,$runtime) + }; + let result = meta::legend::executeLegendQuery($query, [pair('bdate', '2023-10-15T00:00:00')], ^meta::pure::runtime::ExecutionContext(), meta::relational::extension::relationalExtensions()); + assertJsonStringsEqual('{"builder":{"_type":"json"},"values":['+ + '{"id":2,"name":"ProductName2","synonymNames":["GS-Mod-S1","GS-Mod-S3"]},'+ + '{"id":3,"name":"ProductName3","synonymNames":["GS-Mod-S3"]}'+ + ']}', $result); +} + + function <> meta::pure::graphFetch::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::testFlatten_ViaAllVersionsMapping():Boolean[1] { let mapping = meta::relational::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::TargetToModeMappingWithComplexPropertyFlattened_AllVersions; @@ -247,6 +279,28 @@ function meta::pure::graphFetch::tests::m2m2r::milestoning::milestonedSourceToNo ); } +function meta::pure::graphFetch::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::getNoArgFlattenMapping_ViaAssociation():meta::pure::mapping::Mapping[1] +{ + let mappingStr = '###Mapping\n' + + 'Mapping meta::relational::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::TargetToModelMappingWithComplexPropertyFlattened_WithNoArg\n'+ + '(\n'+ + ' *meta::relational::tests::milestoning::TargetProductFlattened: Pure\n'+ + ' {\n'+ + ' ~src meta::relational::tests::milestoning::ProductMilestoned\n'+ + ' id: $src.id,\n'+ + ' name: $src.name,\n'+ + ' synonymNames:$src.synonymsMilestonedViaAssociation.synonym\n'+ + ' }\n' + + ')'; + + let mapping = meta::legend::compileLegendGrammar($mappingStr)->at(0)->cast(@Mapping); + + let newMapping = ^$mapping(includes = ^MappingInclude(included = meta::relational::tests::milestoning::milestoningMapSmall, // fix legend compile to allow mapping reference in include + owner = $mapping) + ); +} + + ###Mapping Mapping meta::relational::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::TargetToModeMapping_AllVersions