Skip to content

Commit d7113a1

Browse files
committed
Ensure enumeration class is valid on generation
1 parent efb7b31 commit d7113a1

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

build.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919

2020
for schema_version in schema_loader.get_schema_versions():
2121

22-
# Skip build for version 1.0
23-
if schema_version == "v1.0":
24-
print("Skipping version v1.0")
25-
continue
26-
2722
# Step 3 - find all involved schemas for the current version
2823
schemas_file_paths = schema_loader.find_schemas(schema_version)
2924
# schemas_file_paths = [path for path in schemas_file_paths if "person" in path] # testing

pipeline/translator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ def _extract_template_variables(self):
248248
if has_controlled_instance:
249249
# Add the controlled instance mixin to the base class
250250
base_class = base_class + " & openminds.internal.mixin.HasControlledInstance"
251-
print(base_class)
252251

253252
if self._schema_model_name == "controlledTerms":
254253
instance_loader = InstanceLoader()
@@ -492,7 +491,8 @@ def _get_display_label_method_expression(schema_short_name, property_names):
492491
elif "name" in property_names:
493492
return "str = obj.name;"
494493
else:
495-
warnings.warn(f"No display label method found for {schema_short_name}.")
494+
#warnings.warn(f"No display label method found for {schema_short_name}.")
495+
print(f"No display label method found for {schema_short_name}.")
496496
return "str = obj.createLabelForMissingLabelDefinition();"
497497

498498

pipeline/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ def _get_template_variables(enum_type, schema_files, root_path):
307307

308308
elif enum_type == "Types":
309309
matlab_class_name = _get_matlab_class_name(schema_info)
310+
# Check if type name already exists
311+
if schema_info['type_name'] in [item['name'] for item in template_variable_list]:
312+
# Skip if type name already exists
313+
continue
310314
template_variable_list.append({'name': schema_info['type_name'], 'class_name': matlab_class_name})
311315

312316
if enum_type == "Types":

0 commit comments

Comments
 (0)