Class: Committee::SchemaValidator::OpenAPI3::ResponseValidator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation_wrapper, validator_option) ⇒ ResponseValidator

Returns a new instance of ResponseValidator.

Parameters:



11
12
13
14
15
16
# File 'lib/committee/schema_validator/open_api_3/response_validator.rb', line 11

def initialize(operation_wrapper, validator_option)
  @operation_wrapper = operation_wrapper
  @validate_success_only = validator_option.validate_success_only
  @check_header = validator_option.check_header
  @allow_empty_date_and_datetime = validator_option.allow_empty_date_and_datetime
end

Instance Attribute Details

#validate_success_onlyObject (readonly)

Returns the value of attribute validate_success_only.



7
8
9
# File 'lib/committee/schema_validator/open_api_3/response_validator.rb', line 7

def validate_success_only
  @validate_success_only
end

Instance Method Details

#call(status, headers, response_data, strict) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/committee/schema_validator/open_api_3/response_validator.rb', line 18

def call(status, headers, response_data, strict)
  return unless Committee::Middleware::ResponseValidation.validate?(status, validate_success_only)

  validator_options = { allow_empty_date_and_datetime: @allow_empty_date_and_datetime }

  operation_wrapper.validate_response_params(status, headers, response_data, strict, check_header, validator_options: validator_options)
end