Validate uniqueness of entity full path
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
- check the branch out and ensure the gdk is running
- in the local instance create a group
- create a subgroup in this group
- make a curl request with the
destination_namespace
as 'group' and thedestination_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"
}
]
}'
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #378435 (closed)
Edited by Carla Drago