Skip to content

Commit

Permalink
Change ix volume and acl features to not use camel case
Browse files Browse the repository at this point in the history
  • Loading branch information
Qubad786 committed Jul 10, 2024
1 parent c407180 commit fca4fe7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions apps_schema/features/ix_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@

class IXVolumeFeature(BaseFeature):

NAME = 'normalize/ixVolume'
NAME = 'normalize/ix_volume'
VALID_SCHEMAS = [DictSchema, StringSchema]

def _validate(self, verrors, schema_obj, schema_str):
if isinstance(schema_obj, StringSchema):
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
10 changes: 5 additions & 5 deletions catalog_reader/questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ 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
elif ref == 'normalize/ix_volume':
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
4 changes: 2 additions & 2 deletions 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 Expand Up @@ -80,7 +80,7 @@
},
},
]
CUSTOM_PORTALS_KEY = 'iXPortals'
CUSTOM_PORTALS_KEY = 'iX_portals'
IX_VOLUMES_ACL_QUESTION = [
{
'variable': 'path',
Expand Down

0 comments on commit fca4fe7

Please sign in to comment.