Skip to content

Commit

Permalink
Revise regular expression and re.sub() command so exactly one space i…
Browse files Browse the repository at this point in the history
…s accepted between a UBKG-recognized soft assay type and square brackets containing values not validated.
  • Loading branch information
Karl Burke committed Dec 5, 2023
1 parent 2258dad commit 741b91d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/schema/schema_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def validate_application_header_before_entity_create(normalized_entity_type, req
def validate_recognized_dataset_type(property_key, normalized_entity_type, request, existing_data_dict, new_data_dict):
# If the proposed Dataset dataset_type ends with something in square brackets, anything inside
# those square brackets are acceptable at the end of the string. Simply validate the start.
proposed_dataset_type_prefix = re.sub(pattern='[ ]*\[.*]$', repl='', string=new_data_dict['dataset_type'])
proposed_dataset_type_prefix = re.sub(pattern='(\S)\s\[.*\]$', repl=r'\1', string=new_data_dict['dataset_type'])
target_list = schema_manager.get_dataset_type_valueset_list()

if proposed_dataset_type_prefix not in target_list:
Expand Down

0 comments on commit 741b91d

Please sign in to comment.