Class: OpenAPIParser::Schemas::Response

Inherits:
Base
  • Object
show all
Defined in:
lib/openapi_parser/schemas/classes.rb,
lib/openapi_parser/schemas/response.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#object_reference, #parent, #raw_schema, #root

Instance Method Summary collapse

Methods inherited from Base

#after_init, #initialize, #inspect

Methods included from Expandable

#expand_reference

Methods included from Findable

#find_object, #purge_object_cache

Methods included from Parseable

#_add_child_object, #_openapi_all_child_objects, #_update_child_object, #build_object_reference, #build_openapi_object, #check_object_schema?, #check_reference_schema?, #child_from_reference, #create_attr_hash_body_objects, #create_attr_hash_object, #create_attr_hash_objects, #create_attr_list_object, #create_attr_list_objects, #create_attr_object, #create_attr_objects, #create_attr_values, #create_hash_body_objects, #create_variable, #escape_reference, included, #load_data

Constructor Details

This class inherits a constructor from OpenAPIParser::Schemas::Base

Instance Attribute Details

#contentHash{String => MediaType}? (readonly)

Returns:



10
# File 'lib/openapi_parser/schemas/response.rb', line 10

openapi_attr_hash_object :content, MediaType, reference: false

Instance Method Details

#validate_parameter(content_type, params) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/openapi_parser/schemas/response.rb', line 12

def validate_parameter(content_type, params)
  # TODO: support wildcard type like application/* (OpenAPI3 definition)

  media_type = content[content_type]
  return nil unless media_type

  options = ::OpenAPIParser::SchemaValidator::Options.new # response validator not support any options
  media_type.validate_parameter(params, options)
end