Class: OpenAPIParser::Schemas::Response
- Includes:
- MediaTypeSelectable
- Defined in:
- lib/openapi_parser/schemas/classes.rb,
lib/openapi_parser/schemas/response.rb
Instance Attribute Summary collapse
-
#content ⇒ Hash{String => MediaType}?
readonly
Content_type to MediaType hash.
-
#headers ⇒ Hash{String => Header}?
readonly
Header string to Header.
Attributes inherited from Base
#object_reference, #parent, #raw_schema, #root
Instance Method Summary collapse
-
#select_media_type(content_type) ⇒ OpenAPIParser::Schemas::MediaType?
select media type by content_type (consider wild card definition).
- #validate(response_body, response_validate_options) ⇒ Object
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
Instance Method Details
#select_media_type(content_type) ⇒ OpenAPIParser::Schemas::MediaType?
select media type by content_type (consider wild card definition)
36 37 38 |
# File 'lib/openapi_parser/schemas/response.rb', line 36 def select_media_type(content_type) select_media_type_from_content(content_type, content) end |
#validate(response_body, response_validate_options) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/openapi_parser/schemas/response.rb', line 19 def validate(response_body, ) validate_header(response_body.headers) if .validate_header media_type = select_media_type(response_body.content_type) unless media_type raise ::OpenAPIParser::NotExistContentTypeDefinition, object_reference if .strict return nil end = ::OpenAPIParser::SchemaValidator::Options.new # response validator not support any options media_type.validate_parameter(response_body.response_data, ) end |