Releases: scalalandio/chimney
v1.5.0
Changelog:
- updated Scala 2.12 to 2.12.20, Scala to 3.3.4, Scala.js to 1.17.0 and Scala Native to 0.5.5
- added the
Result#fromCatchingNonFatal
by @danicheg in #590 - thank you for your first contribution! - fixed some typos by @danicheg in #593
- improved
withFieldRenamed
- now it supports.everyItem
/.everyMapKey
/.everyMapValue
/.matching[Subtype]
/.matchingSome
/.matchingLeft
/.matchingRight
on the source-side of the rename path as well!- done in #616 - added a new Outer Transformers integration - allowing to tell the Chimney how to convert some outer type while Chimney takes care of converting its inner values - and used it to improve the support for Cats' NonEmpty types - fixing #569 in #624
- tested and documented the possibly surprising behavior - that writing to
var
s is enabled with.enableBeanSetters
, and it makes sense! - done in #621 - improvements to
chimney-macro-commons
- module existing since Chimney 0.8.0-M1, which you probably haven't heard about yet:- adding
Type.simplePrint
andDefCache
which should make it easier to use this library for writing other macro libraries (with possibly different use cases than Chimney) - done in #620
- adding
- the first release of
chimney-engine
:- it allows using chimney derivation logic inside your own macros, if what you're trying to do is very close to what Chimney does but when extending it for your use cases requires modifying macros rather than providing an implicit
chimney-engine
has a release cycle tied to core Chimney (meaning the same version), but please consider this API experimental
- bugfix for pattern matcing fall through when the Scala 3's enum parameterless case is lowercased #479 - fixed by @jchyb in #603
- workaround against the bug in the compiler scala/scala3#21672 which would make order of cases in match nondeterministic (breaking cache)- fixed in #623
v1.4.0
Changelog:
- allow setting Chimney flags globally through
-Xmacro-settings
scalac flag - see the docs to be able to globally disable/enable default values, usage of defs, getters/setters, etc (done in #572) - start supporting some simple lens-like operations officially (added testing, bugfixed uncovered cases) - see the docs and start updating your data with
value.into[ValueType].withFieldConst(_.fieldName.matching[Subtype].everyItem, value).transform
and how it compares to e.g. Quicklens (done in #583) - improve the documentation about integrating other libraries with Chimney (done in #584)
v1.3.0
Changelog:
- fix issue in Scala 2 related to (probably?) Symbol initialization AND default values in constructor not relying on companion
apply
(#562, fixed in #563) - improve support for singleton types - case objects and Scala 3 enums as target should always succeed and always be available as a fallback values for parameters (do not require matching input parameter) (#407, fixed in #559)
- add Cats instances (Category/Invariant) for bi-directional transformations (Codec/Iso) (#566)
- improve docs testing - test whether the Scala CLI output printed with pprint matches the expectation (#536, fixed in #567)
- improve Protobufs support for data types modeled using sealed traits:
- implicit with automatic handling of
Empty
oneof forsealed_value
- implicit with automatic handling of
Unrecognized
forenum
- ability to automatically unwrap non-AnyVal value type (enabled with a flag) which can be used to unwrap oneof values (#531, fixed in #568)
- implicit with automatic handling of
v1.2.0
Changelog:
-
chimney-java-collections
module now contains conversions for Scala to/from Java primitives (scala.Int
<->java.lang.Integer
,scala.Double
<->java.lang.Double
, etc) (#535, done in #556) -
introduced
Codec[Domain, Dto]
andIso[A, B]
types which represents bidirectional conversions:Codec
"encodes"Domain
intoDto
usingTransformer
and "decodes"Dto
intoDomain
withPartialTransformer
Iso
represents isomorphism where both directions are handled withTransformer
s
-
allow renaming the subtype in sealed/enum conversions (#409, done in #557)
-
allow enabling default values only for a specific type (e.g.
scalapb.UnknownFieldSet
), allow providing your ownDefaultValue[A]
for cases when it would be convenient to use then but where they are not defined (#408, done in #558)
v1.1.0
Changelog:
-
updated Scala 2.13 to 2.13.14 (#526)
- it's the first release implementing SIP-51
which drops forward comparibility in standard library. It means that every library compiled with 2.13.14 or higher will
evict standard library to higher version - and since the compiler cannot be at lower version than the .ibrary it will also force
Scala version update. This change was reade to merge before Chimney 1.0.0 but we postponed it to give people more time to migrate to this new convention
- it's the first release implementing SIP-51
-
replaced Scala Native 0.4 with Scala Native 0.5 (#545) - while ideally we'd prefer to have a stepping-stone release cross-compiled for both 0.4 and 0.5,
libries that Chimney depends on in its integrations (Cats, Scala Collection Compat, Scala Java Time, ScalaPB) moved directly to
SN 0.5 dropping 0.4 on the spot -
made the order of pattern-matching in sealed trait/enum transformation deterministic (useful for avoiding cache misses) (#543) - thanks to @reimai for the first contribution!
-
replaced hardcoded dependency on DSL's runtime overrides storage from macros internals (#552, fixed in #539)
-
this change unblocks the possibility to provide a different front-end to Chimneys macros (or using Chimney macros inside your macros). It would allow a development of, for instance:
- Ducktape-like DSL without builder-API runtime overhead (
value.transformInto(overrides)
) - Chimney-based lenses - currently Chimney can be used for lenses-like operations
but it only works with.into.overrides.transform
API and bears the costs of builder-API overhead
(with different API it would be possible to update several nested fields with no overhead compared to manually written code!) - specialized derivations - initiatives like moia-oss/teleproto#321 would be able to call and customize Chimney macros directly,
replace Chimney'sTransformer
with their own type class, add/remove derivation rules, etc. with collision with Chimney
If you are interested in this, please contact us using GH discussions!
- Ducktape-like DSL without builder-API runtime overhead (
-
v1.0.0
Release 1.0.0 is the culmination of 7 years of development.
If you are curious about the migration from 0.8.x you'll find the guideline here (tl;dr there should be nothing to worry about as long as you recompile).
Changelog since 0.8.x:
- revamped Cats' instances to match existing conventions (both in Cats as well as in Chimney) (fixed in #443)
Transformer
,PartialTransformer
andpartial.Result
have all instances that make sense for them- conversions from
cats.Validated
topartial.Result
use the same convention as other types (usingAsResult
type class andasResult
extension method introduced in 0.8.0) - for
partial.Result
andPartialTransformer
one can combine values using sequential or parallel semantics (read about them in the docs!!!) - all instances are tested against Cats disciplines
- further improvements to Cats' instances for Chimney types - added
Alternative
type class to the list of provided instances, a few missed discipline tests were added (#465) - provided a flag to disable automatic
Option
unwrapping byPartialTransformer
(#322, addressed by #477) (disabling that behavior by default is not planned) - added a way to customize how source fields/subtypes are matches against target fields/subtypes (#89 and #480, fixed in #478) - thanks to @saeltz for contributing to the PR as the first contribution!
- restored the behavior from before 0.8.x series when only methods returning
Unit
could be considered setters (provides a better fix to #424, fixed in #485). If needed non-Unit setters can be opted-in - detect and report ambiguities with pairing field names (#449, #461, fixed in #485)
- improve error messages when there are
def
methods or other inherited accessors that could be enabled with a flag (fixed in #485) - type-level config representation and internal macros overrides get heavily refactored (#490, #491, #492) (breaking change!)
- which unblocked the development of better nested paths (#493):
- now it is possible to use overrides like
withFieldConst(_.adt.matching[ADT.Subtype].either.matchingRight.collection.everyItem.map.everyMapValue, ...)
- in this first iteration, improved paths to overridden values support only build-in Scala types:
Option
(matchingSome
),Either
(matchingLeft
,matchingRight
), Scala's collections (.everyItem
,.everyMapKey
,.everyMapValue
) but it is planned to extends support for other collections
- now it is possible to use overrides like
- suppress WartRemover/Scapegoat warnings (#496, fixe),d in #497)
- deprecate
withCoproductInstance
in favor orwithSealedSubtypeHandled
andwithEnumCaseHandled
(fixed in #500) - old name is still available but it was@deprecated
since it uses the term "coproduct" basically unknown outside of library writers crowd - documentation now has light/dark theme toggle with the default being whatever your system uses
- fixed to internal representation of subtype-matchiung configs (#499, fixed in #504)
- format scaladoc documentation with scalafmt
wrap = yes
config - fix a bug that occurred in some cases when using
withConstructorPartial
(fixed in #508) - add
withContructorEither
inPartialTransformer
s to make it easier to work with smart constructors based onEither[String, Type]
(done in #509) - created an integration API for providing custom optional types and custom collections (#505)
- extended support for
_.matchingSome
,_.everyItem
,_.everyMapKey
,_.everyMapValue
to every collection provided through integrations API
- extended support for
- migrated chimney-java-collections through new integration API (#510)
- provided support for transformation of cats.data types like
Chain
,NonEmptyChain
, etc through integrations API (#421, fixed in #511) - allow providing an override to a field shared between all subtypes of an ADT (sealed, enum) (#512)
- fix rare case of StackOverflow with Scala 3 enums (#528)
- hide the last API intended for internal usage (#540)
- tests Scala CLI snippets (#523, #524, #534) and extract snippet testing to an external library ScalaCLI.md Spec (#525)
v1.0.0-RC1
This release candidate contains all the functionality intended for 1.0.0 launch. Please help us testing it for bugs. If no bugs - requiring changes to API and breaking binary/source compatibility - are found, Chimney 1.0.0 is planned to be released at 23.05.2024. Then it will move from early-semver to proper semantic versioning.
If you are curious about the migration from 0.8.x you'll find the guideline here (tl;dr there should be nothing to worry about as long as you recompile).
Changelog since 0.8.x:
- revamped Cats' instances to match existing conventions (both in Cats as well as in Chimney) (fixed in #443)
Transformer
,PartialTransformer
andpartial.Result
have all instances that make sense for them- conversions from
cats.Validated
topartial.Result
use the same convention as other types (usingAsResult
type class andasResult
extension method introduced in 0.8.0) - for
partial.Result
andPartialTransformer
one can combine values using sequential or parallel semantics (read about them in the docs!!!) - all instances are tested against Cats disciplines
- further improvements to Cats' instances for Chimney types - added
Alternative
type class to the list of provided instances, a few missed discipline tests were added (#465) - provided a flag to disable automatic
Option
unwrapping byPartialTransformer
(#322, addressed by #477) (disabling that behavior by default is not planned) - added a way to customize how source fields/subtypes are matches against target fields/subtypes (#89 and #480, fixed in #478) - thanks to @saeltz for contributing to the PR as the first contribution!
- restored the behavior from before 0.8.x series when only methods returning
Unit
could be considered setters (provides a better fix to #424, fixed in #485). If needed non-Unit setters can be opted-in - detect and report ambiguities with pairing field names (#449, #461, fixed in #485)
- improve error messages when there are
def
methods or other inherited accessors that could be enabled with a flag (fixed in #485) - type-level config representation and internal macros overrides get heavily refactored (#490, #491, #492) (breaking change!)
- which unblocked the development of better nested paths (#493):
- now it is possible to use overrides like
withFieldConst(_.adt.matching[ADT.Subtype].either.matchingRight.collection.everyItem.map.everyMapValue, ...)
- in this first iteration, improved paths to overridden values support only build-in Scala types:
Option
(matchingSome
),Either
(matchingLeft
,matchingRight
), Scala's collections (.everyItem
,.everyMapKey
,.everyMapValue
) but it is planned to extends support for other collections
- now it is possible to use overrides like
- suppress WartRemover/Scapegoat warnings (#496, fixed in #497)
- deprecate
withCoproductInstance
in favor orwithSealedSubtypeHandled
andwithEnumCaseHandled
(fixed in #500) - old name is still available but it was@deprecated
since it uses the term "coproduct" basically unknown outside of library writers crowd - documentation now has light/dark theme toggle with the default being whatever your system uses
- fixed to internal representation of subtype-matchiung configs (#499, fixed in #504)
- format scaladoc documentation with scalafmt
wrap = yes
config - fix a bug that occurred in some cases when using
withConstructorPartial
(fixed in #508) - add
withContructorEither
inPartialTransformer
s to make it easier to work with smart constructors based onEither[String, Type]
(done in #509) - created an integration API for providing custom optional types and custom collections (#505)
- extended support for
_.matchingSome
,_.everyItem
,_.everyMapKey
,_.everyMapValue
to every collection provided through integrations API
- extended support for
- migrated chimney-java-collections through new integration API (#510)
- provided support for transformation of cats.data types like
Chain
,NonEmptyChain
, etc through integrations API (#421, fixed in #511) - allow providing an override to a field shared between all subtypes of an ADT (sealed, enum) (#512)
v1.0.0-M7
Changelog:
- fix a bug that occurred in some cases when using
withConstructorPartial
(fixed in #508) - add
withContructorEither
inPartialTransformer
s to make it easier to work with smart constructors based onEither[String, Type]
(done in #509)
This pre-release is the fifth of the planned series of internal cleanups. The series is intended to make sure that when 1.0.0 is finally released it will not have any serious (known) issues that could be only addressed by breaking the backward compatibility. We will be really glad if you tested it, and let us know about any such issues while they are still easy to fix.
v1.0.0-M6
Changelog:
- suppress WartRemover/Scapegoat warnings (#496, fixed in #497)
- deprecate
withCoproductInstance
in favor orwithSealedSubtypeHandled
andwithEnumCaseHandled
(fixed in #500) - old name is still available but it was@deprecated
since it uses the term "coproduct" basically unknown outside of library writers crowd - documentation now has light/dark theme toggle with the default being whatever your system uses
- fixed to internal representation of subtype-matchiung configs (#499, fixed in #504)
- format scaladoc documentation with scalafmt
wrap = yes
config
This pre-release is the fifth of the planned series of internal cleanups. The series is intended to make sure that when 1.0.0 is finally released it will not have any serious (known) issues that could be only addressed by breaking the backward compatibility. We will be really glad if you tested it, and let us know about any such issues while they are still easy to fix.
v1.0.0-M5
Changelog:
- type-level config representation and internal macros overrides get heavily refactored (#490, #491, #492) (breaking change!)
- which unblocked the development of better nested paths (#493):
- now it is possible to use overrides like
withFieldConst(_.adt.matching[ADT.Subtype].either.matchingRight.collection.everyItem.map.everyMapValue, ...)
- in this first iteration, improved paths to overridden values support only build-in Scala types:
Option
(matchingSome
),Either
(matchingLeft
,matchingRight
), Scala's collections (.everyItem
,.everyMapKey
,.everyMapValue
) but it is planned to extends support for other collections
- now it is possible to use overrides like
This pre-release is the fifth of the planned series of internal cleanups. The series is intended to make sure that when 1.0.0 is finally released it will not have any serious (known) issues that could be only addressed by breaking the backward compatibility. We will be really glad if you tested it, and let us know about any such issues while they are still easy to fix.