Sha256: 87a4932856dda1abd7f54c4e01f04ba8d47f0fc9deb1e6f520d3b637ee51c599
Contents?: true
Size: 845 Bytes
Versions: 1
Compression:
Stored size: 845 Bytes
Contents
# frozen_string_literal: true 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
media_types-0.5.1 | lib/media_types/scheme/missing_validation.rb |