lib/rack/json_schema/request_validation.rb
# Raises an error if any error detected
# @raise [Rack::JsonSchema::RequestValidation::Error]
Raises an error if any error detected
Raises an error if any error detected
def call
          if has_link_for_current_action?
            if has_body? && !has_valid_content_type?
              unless ignore_invalid_content_type?
                raise InvalidContentType
              end
            else
              case
              when content_type_json? && has_body? && !has_valid_json?
                raise InvalidJson
              when content_type_json? && has_schema? && !has_hash_request_body?
                raise InvalidParameter, "Invalid request. Request body must be an Object in JSON."
              when content_type_json? && has_schema? && !has_valid_parameter?
                raise InvalidParameter, "Invalid request.\n#{schema_validation_error_message}"
              end
            end
          elsif !ignore_missing_path?
            raise LinkNotFound, "Could not find the link definition for request path #{path}."
          end
        end
def call if has_link_for_current_action? if has_body? && ! has_valid_content_type? unless ignore_invalid_content_type? raise InvalidContentType end else case when content_type_json? && has_body? && ! has_valid_json? raise InvalidJson when content_type_json? && has_schema? && ! has_hash_request_body? raise InvalidParameter , "Invalid request. Request body must be an Object in JSON." when content_type_json? && has_schema? && ! has_valid_parameter? raise InvalidParameter , "Invalid request.\n#{schema_validation_error_message}" end end elsif ! ignore_missing_path? raise LinkNotFound , "Could not find the link definition for request path #{path}." end end
Raises an error if any error detected
Raises an error if any error detected
None