Class: OpenAPIParser::Schemas::RequestBody
- Includes:
- MediaTypeSelectable
- Defined in:
- lib/openapi_parser/schemas/classes.rb,
lib/openapi_parser/schemas/request_body.rb
Instance Attribute Summary collapse
-
#content ⇒ Hash{String => MediaType}?
readonly
Content type to MediaType object.
-
#description ⇒ String
readonly
Description data.
-
#required ⇒ Boolean
readonly
Required bool data.
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_request_body(content_type, params, 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
#content ⇒ Hash{String => MediaType}? (readonly)
Returns content type to MediaType object.
15 |
# File 'lib/openapi_parser/schemas/request_body.rb', line 15 openapi_attr_hash_object :content, MediaType, reference: false |
#description ⇒ String (readonly)
Returns description data.
11 |
# File 'lib/openapi_parser/schemas/request_body.rb', line 11 openapi_attr_values :description, :required |
#required ⇒ Boolean (readonly)
Returns required bool data.
11 |
# File 'lib/openapi_parser/schemas/request_body.rb', line 11 openapi_attr_values :description, :required |
Instance Method Details
#select_media_type(content_type) ⇒ OpenAPIParser::Schemas::MediaType?
select media type by content_type (consider wild card definition)
30 31 32 |
# File 'lib/openapi_parser/schemas/request_body.rb', line 30 def select_media_type(content_type) select_media_type_from_content(content_type, content) end |
#validate_request_body(content_type, params, options) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/openapi_parser/schemas/request_body.rb', line 20 def validate_request_body(content_type, params, ) media_type = select_media_type(content_type) return params unless media_type media_type.validate_parameter(params, ) end |