Method: MediaTypes::Scheme#not_strict

Defined in:
lib/media_types/scheme.rb

#not_strictObject

Allow for extra keys in the schema/collection even when passing strict: true to #validate!

Examples:

Allow for extra keys in collection


class MyMedia
  include MediaTypes::Dsl

  validations do
    collection :foo do
      attribute :required, String
      not_strict
    end
  end
end

MyMedia.valid?({ foo: [{ required: 'test', bar: 42 }] })
# => true

See Also:



309
310
311
# File 'lib/media_types/scheme.rb', line 309

def not_strict
  rules.default = NotStrict.new
end