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:



102
103
104
105
106
107
108
109
# File 'lib/media_types/scheme.rb', line 102

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

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