diff --git a/entity-api-spec.yaml b/entity-api-spec.yaml index d609184b..f84dcddb 100644 --- a/entity-api-spec.yaml +++ b/entity-api-spec.yaml @@ -842,6 +842,10 @@ components: type: string readOnly: true description: 'A HuBMAP Consortium wide unique identifier randomly generated in the format HBM###.ABCD.### for every entity.' + error_message: + type: string + readOnly: false + description: 'An open text field that holds the last error message that arose from pipeline validation or analysis.' last_modified_timestamp: type: integer readOnly: true @@ -1476,6 +1480,7 @@ components: created_by_user_sub: 'abcd1234-ef56-gh78-ij90-klmnop123456' uuid: 'abcd1234-ef56-gh78-ij90-klmnop123456' hubmap_id: 'HBM123.ABCD.456' + error_message: 'An error has occurred' last_modified_timestamp: 1710243867000 last_modified_user_sub: 'abcd1234-ef56-gh78-ij90-klmnop123456' last_modified_user_email: 'janedoe@example.com' @@ -1816,6 +1821,7 @@ components: created_by_user_sub: 'abcd1234-ef56-gh78-ij90-klmnop123456' uuid: 'abcd1234-ef56-gh78-ij90-klmnop123456' hubmap_id: 'HBM123.ABCD.456' + error_message: 'An error has occurred' last_modified_timestamp: 1710243867000 last_modified_user_sub: 'abcd1234-ef56-gh78-ij90-klmnop123456' last_modified_user_email: 'janedoe@example.com' @@ -1837,6 +1843,7 @@ components: created_by_user_sub: 'abcd1234-ef56-gh78-ij90-klmnop123456' uuid: 'abcd1234-ef56-gh78-ij90-klmnop123456' hubmap_id: 'HBM123.ABCD.456' + error_message: 'An error has occurred' last_modified_timestamp: 1710243867000 last_modified_user_sub: 'abcd1234-ef56-gh78-ij90-klmnop123456' last_modified_user_email: 'janedoe@example.com' diff --git a/src/schema/provenance_schema.yaml b/src/schema/provenance_schema.yaml index 24b350fe..3ff507e6 100644 --- a/src/schema/provenance_schema.yaml +++ b/src/schema/provenance_schema.yaml @@ -388,7 +388,7 @@ ENTITIES: description: "True if the data contains any human genetic sequence information." error_message: type: string - indexed: true + indexed: false description: "An open text field that holds the last error message that arose from pipeline validation or analysis." status: type: string @@ -1342,6 +1342,10 @@ ENTITIES: - validate_priority_project before_property_create_validators: - validate_priority_project + error_message: + type: string + indexed: false + description: "An open text field that holds the last error message that arose from pipeline validation or analysis." ############################################# EPICollection ############################################# Epicollection: diff --git a/src/schema/schema_validators.py b/src/schema/schema_validators.py index 244277f6..8e2d4255 100644 --- a/src/schema/schema_validators.py +++ b/src/schema/schema_validators.py @@ -811,13 +811,15 @@ def validate_in_admin_group(property_key, normalized_entity_type, request, exist """ def validate_group_name(property_key, normalized_entity_type, request, existing_data_dict, new_data_dict): assigned_to_group_name = new_data_dict['assigned_to_group_name'] - globus_groups = schema_manager.get_auth_helper_instance().getHuBMAPGroupInfo() - group_dict = next((entry for entry in globus_groups.values() if entry.get("displayname") == assigned_to_group_name), None) - if group_dict is None: - raise ValueError("Invalid value for 'assigned_to_group_name'") - is_data_provider = group_dict.get('data_provider') - if not is_data_provider: - raise ValueError("Invalid group in 'assigned_to_group_name'. Must be a data provider") + # If method is PUT, an empty string is allowed, thus validation is skipped. But if a value is given, it must still be validated. + if not (request.method == "PUT" and (not assigned_to_group_name or not str(assigned_to_group_name).strip())): + globus_groups = schema_manager.get_auth_helper_instance().getHuBMAPGroupInfo() + group_dict = next((entry for entry in globus_groups.values() if entry.get("displayname") == assigned_to_group_name), None) + if group_dict is None: + raise ValueError("Invalid value for 'assigned_to_group_name'") + is_data_provider = group_dict.get('data_provider') + if not is_data_provider: + raise ValueError("Invalid group in 'assigned_to_group_name'. Must be a data provider") """