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.



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

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

Instance Method Details

#validate!(metadata, response) ⇒ Object



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

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