fix(module-builder): use pattern_name instead of name in detail template presentation contract #46

Merged
amit merged 1 commits from fix/module-builder-detail-template-pattern-name into main 2026-12-02 05:00:37 +00:00
2 changed files with 12 additions and 1 deletions

View File

@ -1023,7 +1023,7 @@ class ModuleContentCompiler:
"display_order": 0,
},
{
"attribute_key": f"{template_code}.name",
"attribute_key": f"{template_code}.pattern_name",
"empty_behavior": "hide",
"visibility": "show",
"display_order": 0,

View File

@ -500,6 +500,17 @@ async def test_module_content_compiler_full_pipeline(db_session: AsyncSession):
det_tpl = json.loads(compiled_files[f"templates/{mod_code}_ct0005.json"])
validate_definition_document(det_tpl)
validate_presentation_contracts(det_tpl)
det_def_codes = {d["code"] for d in det_tpl["attribute_defs"]}
det_pres_keys = [
a["attribute_key"]
for c in det_tpl["presentation_contracts"]
for a in c["attributes"]
]
assert f"{mod_code}_ct0005.pattern_name" in det_pres_keys
assert f"{mod_code}_ct0005.name" not in det_pres_keys
for key in det_pres_keys:
root_code = key.split(".", 2)[1]
assert root_code in det_def_codes, f"{key} missing from detail attribute_defs"
# 6. Validate Data Documents with Seeder Validators
validate_content_document(json.loads(compiled_files["data/list.json"]))