Class: API::Validations::Validators::BulkImports::DestinationSlugPath

Inherits:
Grape::Validations::Validators::Base
  • Object
show all
Defined in:
lib/api/validations/validators/bulk_imports.rb

Instance Method Summary collapse

Instance Method Details

#validate_param!(attr_name, params) ⇒ Object

Raises:

  • (Grape::Exceptions::Validation)


8
9
10
11
12
13
14
15
16
# File 'lib/api/validations/validators/bulk_imports.rb', line 8

def validate_param!(attr_name, params)
  return if Gitlab::Regex.oci_repository_path_regex.match?(params[attr_name])

  raise Grape::Exceptions::Validation.new(
    params: [@scope.full_name(attr_name)],
    message: "#{Gitlab::Regex.oci_repository_path_regex_message} " \
             "For example, 'destination_namespace' not 'destination/namespace'"
  )
end