Method: MediaTypes::Scheme#validate

Defined in:
lib/media_types/scheme.rb

#validate(output, options = nil, **opts) ⇒ TrueClass

Validates the output and raises on certain validation errors

Parameters:

  • output (#each)

    output to validate

  • opts (Hash)

    a customizable set of options

  • opts[Array<String>] (Hash)

    a customizable set of options

Options Hash (**opts):

  • exhaustive (TrueClass, FalseClass)

    if true, the entire schema needs to be consumed

  • strict (TrueClass, FalseClass)

    if true, no extra keys may be present in output

Returns:

  • (TrueClass)

Raises:

  • ExhaustedOutputError

  • StrictValidationError

  • EmptyOutputError

  • CollectionTypeError

  • ValidationError

See Also:



146
147
148
149
150
151
152
153
# File 'lib/media_types/scheme.rb', line 146

def validate(output, options = nil, **opts)
  options ||= ValidationOptions.new(**opts)
  options.context = output

  catch(:end) do
    validate!(output, options, context: nil)
  end
end