Class: Committee::SchemaValidator::OpenAPI3::RequestValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/committee/schema_validator/open_api_3/request_validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(operation_object, validator_option:) ⇒ RequestValidator

Returns a new instance of RequestValidator.

Parameters:



9
10
11
12
# File 'lib/committee/schema_validator/open_api_3/request_validator.rb', line 9

def initialize(operation_object, validator_option:)
  @operation_object = operation_object
  @validator_option = validator_option
end

Instance Method Details

#call(request, path_params, query_params, body_params, headers) ⇒ Object



14
15
16
17
18
19
# File 'lib/committee/schema_validator/open_api_3/request_validator.rb', line 14

def call(request, path_params, query_params, body_params, headers)
  content_type = ::Committee::SchemaValidator.request_media_type(request)
  check_content_type(request, content_type) if @validator_option.check_content_type

  @operation_object.validate_request_params(path_params, query_params, body_params, headers, @validator_option)
end