Merge pull request 'fix(module-builder): use pattern_name instead of name in detail template presentation contract' (#46) from fix/module-builder-detail-template-pattern-name into main

Reviewed-on: https://git.zedobject.local/AcuPedia/acupedia-api/pulls/46
Reviewed-by: Amit Salunke <amit@noreply.localhost>
This commit is contained in:
Amit Salunke 2026-12-02 05:00:36 +00:00
commit 896bea8a83
2 changed files with 12 additions and 1 deletions

View File

@ -1023,7 +1023,7 @@ class ModuleContentCompiler:
"display_order": 0, "display_order": 0,
}, },
{ {
"attribute_key": f"{template_code}.name", "attribute_key": f"{template_code}.pattern_name",
"empty_behavior": "hide", "empty_behavior": "hide",
"visibility": "show", "visibility": "show",
"display_order": 0, "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"]) det_tpl = json.loads(compiled_files[f"templates/{mod_code}_ct0005.json"])
validate_definition_document(det_tpl) validate_definition_document(det_tpl)
validate_presentation_contracts(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 # 6. Validate Data Documents with Seeder Validators
validate_content_document(json.loads(compiled_files["data/list.json"])) validate_content_document(json.loads(compiled_files["data/list.json"]))