Endpoint 'GET /legaltags/{id}' does not return an existing legal.

User scenario:

  1. create a legal tag: POST /api/legal/v1/legaltags
{
    "name": "storage-Legal-Tag-Test1",
    "description": "Legal Tag added for Storage testing",
    "properties": {
        "contractId": "123456",
        "countryOfOrigin": [
            "US",
            "CA"
        ],
        "dataType": "Public Domain Data",
        "exportClassification": "EAR99",
        "originator": "Autotest",
        "personalData": "No Personal Data",
        "securityClassification": "Private",
        "expirationDate": "2025-12-25"
    }
}
  1. create this legal tag again. HTTP response will be 'A LegalTag already exists for the given name'.
  2. get this legal tag GET /api/legal/v1/legaltags/storage-Legal-Tag-Test1. HTTP response will be 'not found.

However, when we tried to create a legal tag 2 times, we had an error about duplicate.

Dev Team investigation: POST endpoint calculates a hash

String prefix = tenantName + "-";
        if (!legalTag.getName().startsWith(prefix)) {
            legalTag.setName(prefix + legalTag.getName());
        }

That will be used as ID in DB. However, GET endpoint calculates a hash with a formula: hash(legal_tage_name_from_get_request). Thus, we have no consistency between these endpoints.

Edited by Riabokon Stanislav(EPAM)[GCP]