lib/apia/definitions/api.rb
# Validate the API to ensure that everything within is acceptable for use
#
# @param errors [Apia::ManifestErrors]
# @return [void]
Validate the API to ensure that everything within is acceptable for use
Validate the API to ensure that everything within is acceptable for use
def validate(errors)
        if @authenticator && !(@authenticator.respond_to?(:ancestors) && @authenticator.ancestors.include?(Apia::Authenticator))
          errors.add self, 'InvalidAuthenticator', 'The authenticator must be a class that inherits from Apia::Authenticator'
        end
        @controllers.each do |name, controller|
          unless name.to_s =~ /\A[\w\-]+\z/i
            errors.add self, 'InvalidControllerName', "The controller name #{name} is invalid. It can only contain letters, numbers, underscores, and hyphens"
          end
          unless controller.respond_to?(:ancestors) && controller.ancestors.include?(Apia::Controller)
            errors.add self, 'InvalidController', "The controller for #{name} must be a class that inherits from Apia::Controller"
          end
        end
      end
def validate ( errors ) if @authenticator && ! ( @authenticator . respond_to? ( :ancestors ) && @authenticator . ancestors . include? ( Apia :: Authenticator ) ) errors . add self , 'InvalidAuthenticator' , 'The authenticator must be a class that inherits from Apia::Authenticator' end @controllers . each do | name , controller | unless name . to_s =~ / \A [ \w \- ]+ \z /i errors . add self , 'InvalidControllerName' , "The controller name #{name} is invalid. It can only contain letters, numbers, underscores, and hyphens" end unless controller . respond_to? ( :ancestors ) && controller . ancestors . include? ( Apia :: Controller ) errors . add self , 'InvalidController' , "The controller for #{name} must be a class that inherits from Apia::Controller" end end end
Validate the API to ensure that everything within is acceptable for use
Validate the API to ensure that everything within is acceptable for use
None
void
errors
<not_specific>
<not_specific>
None