Class: Rswag::Specs::ResponseValidator

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ResponseValidator.



10
11
12
# File 'lib/rswag/specs/response_validator.rb', line 10

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

Instance Method Details

#validate!(metadata, response) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/rswag/specs/response_validator.rb', line 14

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