Skip to content

Commit a00a002

Browse files
author
Sandeep Rudra
committed
updated check templates
1 parent e4def70 commit a00a002

2 files changed

Lines changed: 10 additions & 15 deletions

File tree

.github/workflows/tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ jobs:
2525
python -m pip install --upgrade pip
2626
pip install "git+https://x-access-token:${TOKEN}@github.com/admin-shell-io/aas-test-engines-exclusive.git@v1.0.0#egg=aas_test_engines_exclusive"
2727
28-
- name: Run template checks (latest version per submodel, AAS 3.1)
28+
- name: Run template checks (AAS metamodel 3.1)
29+
env:
30+
AAS_VERSION: "3.1"
2931
run: python ./_help_and_materials/check_templates.py

_help_and_materials/check_templates.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,11 @@
66
from typing import Iterator, Tuple
77

88
try:
9-
from aas_test_engines_exclusive import file as aas_file
9+
from aas_test_engines_exclusive.v3_1 import file as aas_file
1010
except ImportError:
1111
from aas_test_engines import file as aas_file
1212

13-
AAS_VERSION = "3.1"
14-
15-
EXCLUDED_JSON = frozenset({
16-
"IDTA 02011-1-1-1 _Template_BoM_ExtensionbasedonIEC81346.json",
17-
"IDTA 02011-1-1-1 _Template_BoM_ExtensionbasedonIEC81346_forAASMetamodelV3.1.json",
18-
"IDTA 02068_Template_Provision Of Company Data.json",
19-
"IDTA 02068_Template_Provision Of Company Data_forAASMetamodelV3.1.json",
20-
"IDTA_02018_Template_MaintenanceInstructions.json",
21-
"IDTA_02049_Template_QualityControlForMachining.json",
22-
})
13+
AAS_VERSION = os.environ.get("AAS_VERSION", "3.1")
2314

2415

2516
def print_red(msg: str):
@@ -68,15 +59,17 @@ def check_template(path: pathlib.Path, root: pathlib.Path) -> bool:
6859
return True
6960
ok = True
7061
for i in json_files:
71-
if i.name in EXCLUDED_JSON:
72-
continue
7362
try:
7463
with open(i, "rb") as f:
7564
result = aas_file.check_json_file(f, version=AAS_VERSION)
7665
if result.ok():
7766
print_green(f"- {i.relative_to(root)} is ok")
7867
else:
7968
print_red(f"- {i.relative_to(root)} is invalid")
69+
for line in result.to_lines():
70+
s = line.strip()
71+
if s and "Check meta model" not in s and "Check constraints" not in s and s != "Check":
72+
print_red(f" {s}")
8073
ok = False
8174
except Exception as e:
8275
print_red(f"- {i.relative_to(root)} check failed: {e}")
@@ -92,7 +85,7 @@ def main() -> int:
9285
return 1
9386
folders = find_latest_per_submodel(root_dir, root_dir)
9487
folders.sort(key=lambda p: str(p.relative_to(root_dir)))
95-
print(f"Checking latest version of {len(folders)} submodel(s) under published/ (AAS metamodel {AAS_VERSION}, excluding {len(EXCLUDED_JSON)} file(s) in EXCLUDED_JSON)\n")
88+
print(f"Checking latest version of {len(folders)} submodel(s) under published/ (AAS metamodel {AAS_VERSION})\n")
9689
ok = True
9790
for path in folders:
9891
if not check_template(path, root_dir):

0 commit comments

Comments
 (0)