Class: Openapi3Parser::NodeFactory::RequestBody::ContentValidator
- Inherits:
-
Object
- Object
- Openapi3Parser::NodeFactory::RequestBody::ContentValidator
- Defined in:
- lib/openapi3_parser/node_factory/request_body.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(*args) ⇒ Object
28 29 30 |
# File 'lib/openapi3_parser/node_factory/request_body.rb', line 28 def self.call(*args) new.call(*args) end |
Instance Method Details
#call(validatable) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/openapi3_parser/node_factory/request_body.rb', line 32 def call(validatable) # This validation isn't actually mentioned in the spec, but it # doesn't seem to make sense if this is an empty hash. return validatable.add_error("Expected to have at least 1 item") if validatable.input.empty? validatable.input.each_key do |key| = Validators::MediaType.call(key) next unless context = Context.next_field(validatable.context, key) validatable.add_error(, context) end end |