Skip to content

Commit f05c31d

Browse files
authored
Merge pull request #93 from Raphael-Gazzotti/fix-#91
Fix #91: Vocabulary labels are modified by the build pipeline
2 parents 9c98493 + cdf077a commit f05c31d

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

openMINDS_pipeline/resolver.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def _save_categories(directory_structure, categories):
6060
categories_file = os.path.join(directory_structure.target_directory, "vocab", "categories.json")
6161
with open(categories_file, "w+") as categories_f:
6262
categories_f.write(json.dumps(categories, sort_keys=True, indent=2))
63+
categories_f.write("\n")
6364

6465

6566
def _schemas_by_category(schemas: List[SchemaStructure]) -> Dict[str, List[str]]:

openMINDS_pipeline/vocab.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ def _load_properties(self):
291291
def _save_properties(self):
292292
with open(self._properties_file, "w+") as properties_file:
293293
properties_file.write(json.dumps(self._properties, sort_keys=True, indent=2))
294+
properties_file.write("\n")
294295

295296
def clean_properties(self):
296297
to_be_removed = []
@@ -340,9 +341,11 @@ def _extract_property(self, type: str, property: str, definition: dict):
340341
prop["namePlural"] = None
341342

342343
# Automatically calculated values
343-
unqualified_property = os.path.basename(property)
344-
prop["label"] = _camel_case_to_human_readable(unqualified_property)
345-
prop["name"] = unqualified_property
344+
property_basename = os.path.basename(property)
345+
if "label" not in prop:
346+
prop["label"] = _camel_case_to_human_readable(property_basename)
347+
if "name" not in prop:
348+
prop["name"] = property_basename
346349

347350
if "usedIn" not in prop:
348351
prop["usedIn"] = {}

0 commit comments

Comments
 (0)