- 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
indexattribute type that automatically generates a link list compatible with media_types-serialization. - Add support for
collectionto automatically look up a previously defined schema when passing a view. - Add ability to mark certain attributes as optional when validating with
loose: trueand required otherwise.
- Change dependencies and build output to be debian compatible
- Fix Ruby 2.6 to 2.7 incompatible change
- Add
override_suffixto 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 :yoursuffixcommand to override the default:jsonsuffix. - Remove defaults block.
- Remove registrations block.
- Add the ability to do inline tests when defining validations using
assert_pass '<json>'andassert_fail '<json>'. media_typehas been replaced withuse_name.- It is no longer possible to set a default version. Please use
version <x> doinstead. - You no longer need to specify a custom format string. If you set an organisation with
def self.organisationor set a module wide organisation withMediaTypes::set_organisation <module>, '<organisation>'the library will generate identifiers for you. self.base_formathas been replaced byidentifier_format do |type:, view:, version:, suffix:|.- Add the
emptyvalidation to mark an empty object as valid. - Add the
identifierfunction to get the Media Type Identifier for the validator. - Add
version(x)andview(x)functions. - Add an
available_validationsfunctions 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
validationserror onvalidatable?(now returnsfalse) - Update
bundlerto2.x
- Change default expected type for
attributeto Object - Remove default
actionpackcalls 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
#inspectto look like a tree
- Change internal representation of key to symbol
- Change default type from
niltoObject, removing special behaviour for nil - Add
Rulesclass to handle normalization of keys and handlingrules(Scheme,Attribute, etc) - Add guard classes to handle guard behaviour (
OutputEmptyGuard,OutputTypeGuardandRulesExhaustedGuard) - Add
optional:keywords to most dsl (attribute,collection,any,link) - Add
Formatterclass to handle formatting of theConstructable#to_s - Add behaviour to strip leading dot (
.) or plus (+) from+%<var>ifvaris nil, fixing weird media types - Add behaviour to remove format variable values if format variable is not present, fixing warnings
- Add
inspectfor most public classes - Add second argument for type or scheme to
anydsl, mimickingcollection - Add tests for most dsl, common permutations
- Rename
forcetoexpected_type - Remove
format_viewbehaviour where it adds a dot (.) if a view is present - Remove special iteration behaviour for
Links(linkdsl), allowing them to be optional, or non-exhaustive - Raise error if
self.base_formatis not available at time ofDsl.media_typecall - Fix
expected_typeguard for arrays, nil, or arrays with nil.
- Use strings for
:_links, matching the other validation keys
- Simplify
assert_media_type_formatby dumping views completely - Add test for
merge - Add test for nested blocks in
validationsusingviewandversionnesting - Add test for
validatable? - Add block passing to
Scheme.new
- Add
mergedsl 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_registeredto be more informative and consistent
- Fix an issue with
Hash#compactwhich 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
Baseclass (useMediaTypes::Dslinstead) - Remove a lot of configuration options as they are deemed unneeded
- Remove
active_supportdependency - Rename
ConstructableMimeTypetoConstructable - Moved global scheme types to
Schemeas subtype - Add
MediaTypes::Dsl - Add
validationsblock to capture schemes - Add
registrationsblock to capture register intent - Add
defaultsblock to capture mime type defaults - Add
MediaTypes.registerclass method to callMime::Type.register - Add
Registerablecapture class - Add type / base setting for
Constructable - Add versioned validations
- Add forced types of
collections - Add
attributewith block - Add
EnumerationOfTypefor schema typed arrays - Add
AnyOffor scheme enum types - Add non-block calls for
Schemedsl - Add yard documentation to
/docs
👶 initial release