CHANGELOG.md in attributor-2.6.1 vs CHANGELOG.md in attributor-3.0

- old
+ new

@@ -1,23 +1,37 @@ -Attributor Changelog -============================ +# Attributor Changelog -next ----- +## 3.0.0 -2.6.1 ------ +* Small enhancements on `describe` for types + * avoid creating empty `:attributes` key for `Model` + * ensure embedding `key_type` in `Hash` using `shallow` mode +* Added `Hash#delete`. +* Changed the schema for describing `Hash` to use `attributes` instead of `keys` + * It makes more sense, and it is compatible with Model and Structs too. +* Undefine JRuby package helper methods in `Model` (org, java...) +* Added support to `Collection.load` for any value that responds to `to_a` +* Fixed `Collection.validate` to complain when value object is not a valida type +* Fixed bug where defining an attribute that references a `Collection` would not properly support defining sub-attributes in a provided block. +* Enhanced the type/attribute `describe` methods of types so that they generate an example if an `example` argument is passed in. + * Complex (sub-structured) types will not output examples, only 'leaf' ones. +* Improved handling of exceptions during attribute definitions for `Hash`/`Model` that would previously leave the set of attributes in an undefined state. Now, any attempts to use the type will throw an `InvalidDefinition` exception and include the original exception. (#127) +* Removed `undef :empty?` from `Model` +* Made `Collection` a subclass of Array, and `load` create new instances of it. +* Built in proper loading and validation of any `Attribute#example` when the `:example` option is used. + +## 2.6.1 + * Add the `:custom_data` option for attributes. This is a hash that is passed through to `describe` - Attributor does no processing or handling of this option. * Added `Type.family` which returns a more-generic "family name". It's defined for all built-in types, and is included in `Type.describe`. * Cleanup and bug fixes around example generation for `Model`, `Struct` and `Hash`. * Avoid creating method accessors for true `Hash` types (only `[]` accessors) * Fix common hash methods created for example instances (to play well with lazy attributes) * Avoid storing the `Hash#insensitive_map` unless insensitivity enabled -2.6.0 ------ +## 2.6.0 * Fixed bug in `example_mixin` where lazy_attributes were not evaluated. * Fixed bug in `Hash` where the class would refuse to load from another `Attributor::Hash` when there were no keys defined and they were seemingly compatible. * Fixed a `Hash.dump` bug where nil attribute values would transitively be `dumpe`d therefore causing a nil dereference. * Hardened the `dump`ing of types to support nil values. @@ -25,64 +39,62 @@ * Fixed bug where `Hash#get` would insert a nil value if asked for a key that was not present in the hash. * Fixed bug in `Hash.from_hash` where it would add nil values for keys that are defined on the type but not present in the input. * Added `Hash#merge` that works with two identically-typed hashes * Added `Hash#each_pair` for better duck-type compatibility with ::Hash. -2.5.0 ----- +## 2.5.0 + * Partial support for defining `:default` values through Procs. * Note: this is only "partially" supported the `parent` argument of the Proc will NOT contain the correct attribute parent yet. It will contain a fake class, that will loudly complain about any attempt to use any of its methods. * Fixed `Model.example` to properly handle the case when no attributes are defined on the class. * `Model#dump` now issues a warning if its contents have keys for attributes not present on the class. The unknown contents are not dumped. * `Hash.load` now supports loading any value that responds to `to_hash`. * `Time`, `DateTime`, and `Date` now all return ISO 8601 formatted values from `.dump` (via calling `iso8601` on the value). * Added `Type.id`, a unique value based on the type's class name. -2.4.0 ------- -* `Model` is now a subclass of `Hash`. +## 2.4.0 + +* `Model` is now a subclass of `Hash`. * The interface for `Model` instances is almost entirely unchanged, except for the addition of `Hash`-like methods (i.e., you can now do `some_model[:key]` to access attributes). * This fixes numerous incompatabilities between models and hashes, as well as confusing differences between the behavior when loading a model vs a hash. * `String.load` now raises `IncompatibleTypeError` for `Enumerable` values. -* Added `Symbol` type, use with caution as it will automatically call `#to_sym` on anything loaded. +* Added `Symbol` type, use with caution as it will automatically call `#to_sym` on anything loaded. -2.3.0 ------- +## 2.3.0 * Added `recurse` option to `Type.load` that is used by `Model` and `Hash` to force the loading of values (specifically, so that default values are assigned) even if the loaded value is `nil`. * Fix `Attributor::CSV` to dump `String` values and generate `String` examples. * Default values of `false` now work correctly. * Added `BigDecimal`, `Date` and `Time` types * `DateTime.load` now raises `CoercionError` (instead of returning `nil`) if given values that can not coerced properly. * `Hash.dump` now first calls `Hash.load`, and correctly uses defined value types for dumping. * Added `Hash#get`, for retrieving keys using the same logic the `case_insensitive_load` and `allow_extra` with defined `extra` key. -2.2.1 ------- +## 2.2.1 * Dumping attributes will now load the values if they're not in the native type. * `Model.valid_type?` now accepts hashes. * `Hash`: * Added `:has_key?` to delegation -2.2.0 ------- +## 2.2.0 + * Fix example generation for Hash and Collection to handle a non-Array context parameter. * Hash: * Added additional options: * `:case_insensitive_load` for string-keyed hashes. This allows loading hashes with keys that do not exactly match the case defined in the hash. * Added `:allow_extras` option to allow handling of undefined keys when loading. * Added `Hash#set` to encapsulate the above options and attribute loading. * Added `extra` command in the `keys` DSL, which lets you define a key (whose value should be a Hash), to group any unspecified keys during load. -2.1.0 ------- +## 2.1.0 + * Structs now inherit type-level options from their reference. * Add Collection subclasses for CSVs and Ids * CSV type for Collection of values serialized as comma-separated strings. * Ids type. A helper for creating CSVs with members matching a given a type's :identity option. * Allow instances of Models to be initialized with initial data. @@ -101,11 +113,11 @@ simply defining the types of keys) * Loaded Hash types now return instances of the class rather than a simple Ruby Hash. * Introduced a new FileUpload type. This can be easily used in Web servers to map incoming multipart file uploads. * Introduced a new Tempfile type. -2.0.0 ------- + +## 2.0.0 * Added new exception subtypes (load methods return more precise errors now) * Changed ```Attributor::Model``` to be a class instead of module. * Improved handling of ```Attributor::Model``` examples: * Support creating examples with specific values. i.e.: