Class: API::Validations::Validators::BulkImports::DestinationNamespacePath

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)


21
22
23
24
25
26
27
28
29
30
# File 'lib/api/validations/validators/bulk_imports.rb', line 21

def validate_param!(attr_name, params)
  return if params[attr_name].blank?
  return if NamespacePathValidator.valid_path?(params[attr_name])

  raise Grape::Exceptions::Validation.new(
    params: [@scope.full_name(attr_name)],
    message: "must be a relative path and not include protocol, sub-domain, or domain information. " \
             "For example, 'destination/full/path' not 'https://example.com/destination/full/path'"
  )
end