Class: OpenApi::Rswag::Specs::ResponseValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/open_api/rswag/specs/response_validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(config = ::OpenApi::Rswag::Specs.config) ⇒ ResponseValidator

Returns a new instance of ResponseValidator.



12
13
14
# File 'lib/open_api/rswag/specs/response_validator.rb', line 12

def initialize(config = ::OpenApi::Rswag::Specs.config)
  @config = config
end

Instance Method Details

#validate!(metadata, response) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/open_api/rswag/specs/response_validator.rb', line 16

def validate!(, response)
  swagger_doc = @config.get_swagger_doc([:swagger_doc])

  validate_code!(, response)
  validate_headers!(, response.headers)
  validate_body!(, swagger_doc, response.body)
end