PureConfig v0.6.0 Release Notes

Release Date: 2017-02-14 // about 7 years ago
    • 🆕 New features

      • New ProductHint trait allowing customization of the derived ConfigConvert for case classes, superseeding ConfigFieldMapping (docs). In addition to defining field name mappings, ProductHint instances control:
      • Whether default field values should be used when fields are missing in the config (docs);
      • Whether unknown keys are ignored or cause pureconfig to return a Failure (docs).
      • Support for reading and writing java.util.UUIDs;
      • Support for reading and writing java.nio.file.Paths;
      • Support for reading and writing java.net.URIs;
      • Support multiple failures, e.g. when multiple fields of a class fail to convert;
      • Add ConfigReaderFailure ADT to model failures and ConfigReaderFailures to represent a non empty list of errors;
      • Add ConfigValueLocation, which is the physical location of a ConfigValue represented by a file name and a line number;
      • Add loadConfigOrThrow methods to the API;
      • Add helpers to create ConfigConvert:
      • ConfigConvert.fromStringConvert that requires a function String => Either[ConfigReaderFailure, T]
      • ConfigConvert.fromStringConvertTry that requires a function String => Try[T]
      • ConfigConvert.fromStringConvertOpt that requires a function String => Option[T]
      • Add ConfigConvert.catchReadError to convert a function that can throw exception into a safe function that returns a Either[CannotConvert, T];
    • 💥 Breaking changes

      • ConfigConvert.from now returns a value of type Either[ConfigReaderFailures, T] instead of Try[T];
      • CoproductHint has been changed to adapt to the new ConfigConvert:
      • CoproductHint.from now returns a value of type Either[ConfigReaderFailures, Option[ConfigValue]]
      • CoproductHint.to now returns a value of type Either[ConfigReaderFailures, Option[ConfigValue]]
      • The default field mapping changed from camel case config keys (e.g. exampleKey) to kebab case keys (e.g. example-key). Case class fields are still expected to be camel case. The old behavior can be retained by putting in scope an implicit def productHint[T] = ProductHint[T](ConfigFieldMapping(CamelCase, CamelCase));
      • ConfigFieldMapping has no type parameters now;
      • ConfigFieldMapping was replaced by ProductHint as the type of object to put in scope in order to customize the derivation of ConfigConvert for case class. Old ConfigFieldMapping implicit instances in scope have no effect now. The migration can be done by replacing code like implicit def mapping: ConfigFieldMapping[T] = <mapping> with implicit def productHint: ProductHint[T] = ProductHint(<mapping>);
      • ConfigConvert.fromString, ConfigConvert.fromNonEmptyString, ConfigConvert.vstringConvert, ConfigConvert.nonEmptyStringConvert are now deprecated and the new helpers should be used instead.