v1.0.0-RC31
Following are the breaking changes
While we understand constant refinements lead to breaking changes for the users, the following changes were necessary to bring in consistency across all ZIO projects, mainly with respect to naming. We will ensure there are no more breaking changes (unless very necessary based on feedback from users) by considering this release as a preparation to 1.0 release.
PS: The delay in 1.0 release is due to the fact we are bringing in more modules, features and refinements (across all the 11 modules) and make sure users get the most out of the features and seamless interaction with zio-config.
- Auto derivation not assuming any change in the names of sealed traits, and case class names. The names will not be converted to snake_case or kebab-case automatically.
- Renaming
xmap
totransform
- Renaming
xmapEither
totransformOrFail
- zio-config-refined has better type inference.
- Disable recursion to make sure zio-config stays reliable with all the rest of the important features (#461). We will be revisiting recursion as soon as possible.
Example:
// Before RC31
refine[List[String], NonEmpty](list("port")(int))
// After RC31
refine[NonEmpty](list("port")(int))
// More details in website.
- Auto derivations don't make assumptions on the name of sealed traits and case classes. The names will be kept as it is.
You can use@name
annotation to customise names or use.mapKey
functionality inConfigDescriptor
.
NOTE: For better type inference with transformOrFail, users might need to give provide return types or explicitly give the type as given below
final case class Port(value: Int)
val port: ConfigDescriptor[Int] =
int("PORT").transformOrFail(
x => if (port > 10) Right(Port(x)) else Left("invalid port"),
port => Right(port.value)
)
// or
val port =
int("PORT").transformOrFail[Port](
x => if (port > 10) Right(Port(x)) else Left("invalid port"),
port => Right(port.value)
)
Following are the additions
- Function transformOrFailLeft, if only read fails
- Function transformOrFailRight, if only write fails.
- Lots of API docs.
- Incorporating Lazy nodes into ConfigDescriptor.
- Adding zio-config-gen module, allowing generation of an example config, given a ConfigDescriptor.