Skip to content

Commit 636d7bb

Browse files
committed
Rename schema_PoC_optimizer.json to schema_NWN_optimizer.json; Improve ESDL reference path handling in util function
1 parent 3d61fd9 commit 636d7bb

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

esdlvalidator/validation/functions/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ def get_attr_or_ref_attr(obj, attr_path: str):
3030

3131
value = obj.eGet(attr)
3232

33+
# If the attribute is a reference object (e.g., QuantityAndUnitReference),
34+
# try to resolve it to the actual target entity.
35+
if hasattr(value, "reference") and value.reference:
36+
value = value.reference
37+
3338
if not remaining:
3439
return value
3540

testdata/schemas/schema_PoC_optimizer.json renamed to testdata/schemas/schema_NWN_optimizer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@
10641064
"name": "optional_fixedMaintenanceCosts_are_set",
10651065
"description": "Report warnings if costInformation.fixedMaintenanceCosts [EUR/MW/yr] or [[EUR/kW/yr] are not set or incorrectly set for the defined assets.",
10661066
"type": "warning",
1067-
"message": "Fixed Maintenance Costs [EUR/MW/yr] or [[EUR/kW/yr] is incomplete or incorrect",
1067+
"message": "Fixed Maintenance Costs [EUR/MW/yr] or [EUR/kW/yr] is incomplete or incorrect",
10681068
"selects": [{
10691069
"function": "get",
10701070
"alias": "assets",
@@ -1225,9 +1225,9 @@
12251225
{ "attribute": "profileQuantityAndUnit", "count_as_null": [] }
12261226
],
12271227
"valid_checks": [
1228-
{ "attribute": "profileQuantityAndUnit.reference.physicalQuantity", "count_as_valid": "POWER" },
1229-
{ "attribute": "profileQuantityAndUnit.reference.unit", "count_as_valid": "WATT" },
1230-
{ "attribute": "profileQuantityAndUnit.reference.multiplier", "count_as_valid": ["MEGA", "KILO"] }
1228+
{ "attribute": "profileQuantityAndUnit.physicalQuantity", "count_as_valid": "POWER" },
1229+
{ "attribute": "profileQuantityAndUnit.unit", "count_as_valid": "WATT" },
1230+
{ "attribute": "profileQuantityAndUnit.multiplier", "count_as_valid": ["MEGA", "KILO"] }
12311231
],
12321232
"resultMsgJSON": true,
12331233
"resultMsgAtParentNode": true

0 commit comments

Comments
 (0)