Class: OpenapiFirst::RuntimeResponse
- Inherits:
-
Object
- Object
- OpenapiFirst::RuntimeResponse
- Defined in:
- lib/openapi_first/runtime_response.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(operation, rack_response) ⇒ RuntimeResponse
constructor
A new instance of RuntimeResponse.
- #validate ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(operation, rack_response) ⇒ RuntimeResponse
Returns a new instance of RuntimeResponse.
7 8 9 10 |
# File 'lib/openapi_first/runtime_response.rb', line 7 def initialize(operation, rack_response) @operation = operation @rack_response = rack_response end |
Instance Method Details
#description ⇒ Object
12 13 14 |
# File 'lib/openapi_first/runtime_response.rb', line 12 def description response_definition&.description end |
#validate ⇒ Object
16 17 18 |
# File 'lib/openapi_first/runtime_response.rb', line 16 def validate ResponseValidation::Validator.new(@operation).validate(@rack_response) end |
#validate! ⇒ Object
20 21 22 23 |
# File 'lib/openapi_first/runtime_response.rb', line 20 def validate! error = validate error&.raise! end |