- Fix crash when defining multiple versions of a validator
- Fix that causes bailout in nested rule to stop validation altogether
- Fix build issue that caused debian package to be empty
- Add ability to define multiple versions using one block.
- Add
index
attribute type that automatically generates a link list compatible with media_types-serialization. - Add support for
collection
to automatically look up a previously defined schema when passing a view. - Add ability to mark certain attributes as optional when validating with
loose: true
and required otherwise.
- Change dependencies and build output to be debian compatible
- Fix Ruby 2.6 to 2.7 incompatible change
- Add
override_suffix
to force a specific suffix - Fix all deprecation warnings
- Views can now be accessed indifferently.
- Attribute keys no longer match indifferently.
- Fixed infinite loop when validating non-hash, non-array items.
- Remove ability to set default suffix. All suffixes now default to
+json
. - Suffixes are now set for a given view and version instead of as a block.
- Add
suffix :yoursuffix
command to override the default:json
suffix. - Remove defaults block.
- Remove registrations block.
- Add the ability to do inline tests when defining validations using
assert_pass '<json>'
andassert_fail '<json>'
. media_type
has been replaced withuse_name
.- It is no longer possible to set a default version. Please use
version <x> do
instead. - You no longer need to specify a custom format string. If you set an organisation with
def self.organisation
or set a module wide organisation withMediaTypes::set_organisation <module>, '<organisation>'
the library will generate identifiers for you. self.base_format
has been replaced byidentifier_format do |type:, view:, version:, suffix:|
.- Add the
empty
validation to mark an empty object as valid. - Add the
identifier
function to get the Media Type Identifier for the validator. - Add
version(x)
andview(x)
functions. - Add an
available_validations
functions that returns all defined validations. - Fix an issue where validations could accidentally merge if defined with a bad
base_format
. - Fix an issue where undefined validations would accept an empty object.
- Fix handling empty collections
- Fix no
validations
error onvalidatable?
(now returnsfalse
) - Update
bundler
to2.x
- Change default expected type for
attribute
to Object - Remove default
actionpack
calls for.register
- Add integration for registering with
actionpack
(rails) - Add integration for registering with
http
(http.rb) - Fix stack overflow for cyclic schema
- Fix an issue with
attribute(optional:, &block)
not passingoptional:
to the createdcollection
.
- Fix formatter reworked template when fields are not present
- Remove
require 'awesome_print'
in library code as it's marked as a development dependency onlvy
- Add requires in files with missing requires
- Fix merging optional attributes
- Change
#inspect
to look like a tree
- Change internal representation of key to symbol
- Change default type from
nil
toObject
, removing special behaviour for nil - Add
Rules
class to handle normalization of keys and handlingrules
(Scheme
,Attribute
, etc) - Add guard classes to handle guard behaviour (
OutputEmptyGuard
,OutputTypeGuard
andRulesExhaustedGuard
) - Add
optional:
keywords to most dsl (attribute
,collection
,any
,link
) - Add
Formatter
class to handle formatting of theConstructable#to_s
- Add behaviour to strip leading dot (
.
) or plus (+
) from+%<var>
ifvar
is nil, fixing weird media types - Add behaviour to remove format variable values if format variable is not present, fixing warnings
- Add
inspect
for most public classes - Add second argument for type or scheme to
any
dsl, mimickingcollection
- Add tests for most dsl, common permutations
- Rename
force
toexpected_type
- Remove
format_view
behaviour where it adds a dot (.
) if a view is present - Remove special iteration behaviour for
Links
(link
dsl), allowing them to be optional, or non-exhaustive - Raise error if
self.base_format
is not available at time ofDsl.media_type
call - Fix
expected_type
guard for arrays, nil, or arrays with nil.
- Use strings for
:_links
, matching the other validation keys
- Simplify
assert_media_type_format
by dumping views completely - Add test for
merge
- Add test for nested blocks in
validations
usingview
andversion
nesting - Add test for
validatable?
- Add block passing to
Scheme.new
- Add
merge
dsl to merge twoScheme
- Change validation to accept both symbolised and stringified input ánd validations
- Add automatic require for
media_types/scheme/any_of
- Change messages for
assert_media_types_registered
to be more informative and consistent
- Fix an issue with
Hash#compact
which was introduce in 2.4+. Now works with Ruby 2.3
- Fix an issue with
Registrar#versions
- Fix link in the gemspec to Github
- Fix an issue with
Constructable#valid?
andConstructable#validate!
Breaking changes to update public API and usage
- Remove
Base
class (useMediaTypes::Dsl
instead) - Remove a lot of configuration options as they are deemed unneeded
- Remove
active_support
dependency - Rename
ConstructableMimeType
toConstructable
- Moved global scheme types to
Scheme
as subtype - Add
MediaTypes::Dsl
- Add
validations
block to capture schemes - Add
registrations
block to capture register intent - Add
defaults
block to capture mime type defaults - Add
MediaTypes.register
class method to callMime::Type.register
- Add
Registerable
capture class - Add type / base setting for
Constructable
- Add versioned validations
- Add forced types of
collection
s - Add
attribute
with block - Add
EnumerationOfType
for schema typed arrays - Add
AnyOf
for scheme enum types - Add non-block calls for
Scheme
dsl - Add yard documentation to
/docs
👶 initial release