Sha256: 6c174c954a4fcfebc0760d9364189ad7b05c2c0fcc630fb53dcf12d864a7a112
Contents?: true
Size: 884 Bytes
Versions: 8
Compression:
Stored size: 884 Bytes
Contents
# frozen_string_literal: true require 'media_types/scheme/errors' module MediaTypes class Scheme class MissingValidation def validate!(_output, options, context:, **_opts) # Check that no unknown keys are present return true unless options.strict raise_strict!(key: context.key, strict_keys: context.rules, backtrace: options.backtrace) end def raise_strict!(key:, backtrace:, strict_keys:) raise StrictValidationError, format( "Unknown key %<key>s in data.\n" \ "\tFound at: %<backtrace>s\n" \ "\tExpected:\n\n" \ '%<strict_keys>s', key: key.inspect, backtrace: backtrace.join('->'), strict_keys: strict_keys.inspect(1) ) end def inspect '((raise when strict))' end end end end
Version data entries
8 entries across 8 versions & 1 rubygems