Class: OpenAPIParser::Schemas::Responses
- Defined in:
- lib/openapi_parser/schemas/classes.rb,
lib/openapi_parser/schemas/responses.rb
Instance Attribute Summary collapse
-
#default ⇒ Response, ...
readonly
Default response object.
-
#response ⇒ Hash{String => Response, Reference}?
readonly
Response object indexed by status code.
Attributes inherited from Base
#object_reference, #parent, #raw_schema, #root
Instance Method Summary collapse
-
#validate(response_body, response_validate_options) ⇒ Object
validate params data by definition find response object by status_code and content_type github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#patterned-fields-1.
Methods inherited from Base
#after_init, #initialize, #inspect
Methods included from Expandable
Methods included from Findable
#find_object, #purge_object_cache
Methods included from Parser
#_openapi_all_child_objects, #_update_child_object, included, #load_data
Constructor Details
This class inherits a constructor from OpenAPIParser::Schemas::Base
Instance Attribute Details
#default ⇒ Response, ... (readonly)
Returns default response object.
7 |
# File 'lib/openapi_parser/schemas/responses.rb', line 7 openapi_attr_object :default, Response, reference: true |
#response ⇒ Hash{String => Response, Reference}? (readonly)
Returns response object indexed by status code. see: github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#patterned-fields-1.
11 |
# File 'lib/openapi_parser/schemas/responses.rb', line 11 openapi_attr_hash_body_objects 'response', Response, reject_keys: [:default], reference: true, allow_data_type: false |
Instance Method Details
#validate(response_body, response_validate_options) ⇒ Object
validate params data by definition find response object by status_code and content_type github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#patterned-fields-1
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/openapi_parser/schemas/responses.rb', line 18 def validate(response_body, ) return nil unless response if (res = find_response_object(response_body.status_code)) return res.validate(response_body, ) end raise ::OpenAPIParser::NotExistStatusCodeDefinition, object_reference if .strict nil end |