Skip to content

Add regex validation to entity model

What does this MR do and why?

This change adds regex validation to destination_name (aka destination_slug), destination_namespace, and source_full_path attributes of a BulkImports::Entity model. This validation ensures respective values are in the accepted format.

The validation uses the Gitlab::Regex module, and I've updated/renamed/added regexes in the module to cover the different formats of a destination_namespace (which can be an empty string in the case of an api POST request) and a source_full_path, which cannot be an empty string.

While there are a large number of changes in the MR, the bulk of these are simply updating specs to use correctly formatted values for these attributes (e.g. changing 'My Destination Path' to 'My-Destination-Path').

It completes work started in #383760 (closed), which added similar validations to the GraphQL api endpoint.

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 #388385 (closed)

Edited by Carla Drago

Merge request reports

Loading