fix(module-builder): use pattern_name instead of name in detail template presentation contract #46
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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"]))
|
||||
|
|
|
|||
Loading…
Reference in New Issue