Skip to content

Releases: LukasKalbertodt/confique

v0.4.0

27 Oct 13:27
63afcdc

Choose a tag to compare

The main feature of this release is better compatibility with using other derives on your config types, e.g. clap or typed-builder. See the added examples.

  • Breaking: rename Partial to Layer (including from_partial -> from_layer, partial_attr -> layer_attr, and more).
    • The new name more accurately reflects how the type is used most of the time. It is also less awkward to read/use as unlike "partial", "layer" is a proper noun.
  • Breaking: require the (unresolved) symbol Option to be in scope and refer to std::option::Option where derive(Config) is used.
    • While technically breaking, this is unlikely to affect anyone, since hardly any Rust code shadows Option.
    • This change allows confique to emit just Option for the partial type, which in turn enables you to use other derives with it (e.g. clap).
  • Allow multiple validate attributes on fields (all validations are performed).
  • Forward field docs to layer type. This is especially useful when using derives on the layer, which read the docs.
  • Add examples clap and builder, showing how you can derive useful traits for the layer type.
  • Add clarification about Config vs Deserialize to the docs.
  • (Technically breaking) Remove implicit crate feature serde_yaml. Use yaml instead!

v0.3.1

26 Jul 12:07
07fe6a5

Choose a tag to compare

  • Allow #[config(partial_attr(...))] on fields (thanks @aschey, in #44)
  • Update toml dependency to 0.9
  • Fix outdated description in docs of Partial::from_env
  • Fix typo in docs
  • Fix license in Cargo.toml to use proper SPDX syntax
  • Specify exact version requirement of dependencies

v0.3.0

18 Oct 14:59
e5d3420

Choose a tag to compare

  • Breaking: Raise MSRV to 1.61.0
  • Breaking: toml, yaml and json5 are no longer default features (19d9ddc). You now have to manually specify the features you need in Cargo.toml.
  • Breaking: env vars set to an empty string, which fail to deserialize/parse/validate are now treated as not set. This is technically a breaking change, but I think this is the expected behavior and shouldn't affect you. (#39)
  • ⭐ Add validation feature (#40)
    • #[config(validate = path::to::function)] field: u32 to call the given function during field deserialization.
    • #[config(validate(!s.is_empty(), "user must not be empty"))] user: String is a assert!-style syntax to simple validation checks.
    • Validation can also be added to full structs.
    • See docs and examples for more information!
  • Stop including Error::source in the Display output of Error (d454f0957)
  • Improve & refactor docs of derive(Config a bit
  • Update dependencies (syn to 2.0, heck to 0.5): this shouldn't affect you, except for faster compile times due to smaller dependency tree.

v0.2.6

10 Oct 10:32
27b2620

Choose a tag to compare

  • Fix compile errors when using confique derive without having serde in your direct dependencies (see #38).
  • Update toml dependency to 0.8
  • Fix some typos in docs

v0.2.5

10 Dec 11:22
15c729d

Choose a tag to compare

  • Add #[config(partial_attr(...))] struct attribute to specify attributes for
    the partial type.
  • Allow "yes" and "no" as values when deserializing bool from env. Also, the
    match is done completely case insensitive now, such that e.g. "True", "tRuE"
    are accepted now.

0.2.4

02 Jul 08:19
0a79a43

Choose a tag to compare

  • Fixed enum deserialization from env values

v0.2.3

10 Mar 12:12
29a5c05

Choose a tag to compare

Fixed

  • Add #[allow(missing_docs)] to some generated code to avoid problems in
    crates that #[forbid(missing_docs)] globally.
  • Fix badge in README

Added

  • Add short docs to generated module (to explains its purpose and avoid
    confusion when people find it in their docs)

Changed

  • Internal change that potentially improves compile time a tiny bit.

v0.2.2

25 Nov 09:08
7830f32

Choose a tag to compare

Fixed

  • Use fully qualified paths for all symbols emitted by the derive macro.
    Before this, the derive would throw errors if you shadowed any of the symbols
    Result, Option, Ok, None or Some. A test has been added to make sure
    this does not happen again in the future.
    (Partially in #23, thanks @aschey)

v0.2.1

06 Nov 11:47
ad48850

Choose a tag to compare

Added

  • parse_env attribute for custom parsing of environment variables (allows you
    to load lists and other complex objects from env vars).
    (in #22, thanks @cyphersnake)

Changed

  • Updated serde_yaml to 0.9 (this is only an internal dependency).

v0.2.0

21 Oct 17:07
324cede

Choose a tag to compare

Added

  • Add support for array default values, e.g. #[config(default = [1, 2, 3])
  • Add support for map default values, e.g. #[config(default = { "cat": 3, "dog": 5 })
  • Add JSON5 support
  • Show environment variable key in config template
  • Impl PartialEq for all meta items
  • Impl Serialize for meta::Expr

Changed

  • Breaking: rename {toml,yaml}::format to template
  • Breaking: make FormatOptions and some meta types #[non_exhaustive]
  • Move to Rust 2021 (bumps MSRV to 1.56)
  • Improved docs

Fixed

  • Fix type inference for float default values
  • Fix name clash with generated helper functions
  • Fix incorrect newlines for string default values in YAML config template

Internal

  • Rewrite large parts of the crate, mostly to deduplicate logic
  • Add lots of tests