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
# 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
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



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

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

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