Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update casing on variable names #27

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading