Skip to content

Validate uniqueness of entity full path

Carla Drago requested to merge 378435-validate-entity-path-uniqueness into master

What does this MR do and why?

This change ensures the destination_slug specified in a bulk_import POST request is unique for the destination_namespace specified. If not, a suitable error message is returned.

How to set up and validate locally

  1. check the branch out and ensure the gdk is running
  2. in the local instance create a group
  3. create a subgroup in this group
  4. make a curl request with the destination_namespace as 'group' and the destination_slug as 'subgroup'
curl --location --request POST 'http://gdk.test:3000/api/v4/bulk_imports' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "configuration": {
        "url": "http://gdk.test:3000",
        "access_token": "e<TOKEN>"
    },
    "entities": [
        {
            "source_full_path": "gitlab-org",
            "source_type": "group_entity",
            "destination_slug": "subgroup",
            "destination_namespace": "group"
        }
    ]
}'
  1. observe the error message returned is

"{"message":"Validation failed: Import failed: subgroup already exists in the group namespace.\nPlease ensure all group slugs are unique to the parent namespace."}%."

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #378435 (closed)

Edited by Carla Drago

Merge request reports