Skip to content

Commit

Permalink
update casing on variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros-k committed Jul 2, 2024
1 parent 34a3ee3 commit 3701d7c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions apps_schema/features/ix_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ def _validate(self, verrors, schema_obj, schema_str):
return

attrs = schema_obj.attrs
if 'datasetName' not in attrs:
verrors.add(f'{schema_str}.attrs', 'Variable "datasetName" must be specified.')
elif not isinstance(attrs[attrs.index('datasetName')].schema, StringSchema):
verrors.add(f'{schema_str}.attrs', 'Variable "datasetName" must be of string type.')
if 'dataset_name' not in attrs:
verrors.add(f'{schema_str}.attrs', 'Variable "dataset_name" must be specified.')
elif not isinstance(attrs[attrs.index('dataset_name')].schema, StringSchema):
verrors.add(f'{schema_str}.attrs', 'Variable "dataset_name" must be of string type.')

if 'aclEntries' in attrs and not isinstance(attrs[attrs.index('aclEntries')].schema, DictSchema):
verrors.add(f'{schema_str}.attrs', 'Variable "aclEntries" must be of dict type.')
if 'acl_entries' in attrs and not isinstance(attrs[attrs.index('acl_entries')].schema, DictSchema):
verrors.add(f'{schema_str}.attrs', 'Variable "acl_entries" must be of dict type.')

if 'properties' in attrs:
index = attrs.index('properties')
Expand Down
8 changes: 4 additions & 4 deletions catalog_reader/questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def normalize_question(question: dict, version_data: dict, context: dict) -> Non
elif ref == 'normalize/acl':
data['attrs'] = ACL_QUESTION
elif ref == 'normalize/ixVolume':
if schema['type'] == 'dict' and any(i['variable'] == 'aclEntries' for i in schema['attrs']):
# get index of aclEntries from attrs
acl_index = next(i for i, v in enumerate(schema['attrs']) if v['variable'] == 'aclEntries')
# insert acl question before aclEntries
if schema['type'] == 'dict' and any(i['variable'] == 'acl_entries' for i in schema['attrs']):
# get index of acl_entries from attrs
acl_index = next(i for i, v in enumerate(schema['attrs']) if v['variable'] == 'acl_entries')
# insert acl question before acl_entries
schema['attrs'][acl_index]['schema']['attrs'] = IX_VOLUMES_ACL_QUESTION

schema.update(data)
Expand Down
2 changes: 1 addition & 1 deletion catalog_reader/questions_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'schema': {
'type': 'list',
'items': [{
'variable': 'aclEntry',
'variable': 'acl_entry',
'label': 'ACL Entry',
'schema': {
'type': 'dict',
Expand Down

0 comments on commit 3701d7c

Please sign in to comment.