Class: Openapi3Parser::Validators::MediaType

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi3_parser/validators/media_type.rb

Constant Summary collapse

REGEX =
%r{
  \A
  (\w+|\*) # word or asterisk
  / # separating slash
  ([-+.\w]+|\*) # word (with +, - & .) or asterisk
  \Z
}x

Class Method Summary collapse

Class Method Details

.call(input) ⇒ Object



14
15
16
17
# File 'lib/openapi3_parser/validators/media_type.rb', line 14

def self.call(input)
  message = %("#{input}" is not a valid media type)
  message unless REGEX.match(input)
end