-
-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility regression: #[schemars(default)]
now validates types
#144
Comments
The new functionality is problematic for us. We are currently using the For instance this field:
Gives a compile error:
But the whole point of using |
This breaking change was not intended - I'll back out the change from #83 and release a new version |
Thanks! |
Fixed in v0.8.10, now on crates.io |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [clap](https://togithub.com/clap-rs/clap) | dependencies | patch | `3.1.12` -> `3.1.18` | | [const_format](https://togithub.com/rodrimati1992/const_format_crates) | dependencies | patch | `0.2.22` -> `0.2.24` | | [proc-macro2](https://togithub.com/dtolnay/proc-macro2) | dependencies | patch | `1.0.37` -> `1.0.39` | | [quote](https://togithub.com/dtolnay/quote) | dependencies | patch | `1.0.17` -> `1.0.18` | | [regex](https://togithub.com/rust-lang/regex) | dependencies | patch | `1.5.5` -> `1.5.6` | | [schemars](https://graham.cool/schemars/) ([source](https://togithub.com/GREsau/schemars)) | dependencies | patch | `=0.8.8` -> `=0.8.10` | | [serde](https://serde.rs) ([source](https://togithub.com/serde-rs/serde)) | dependencies | patch | `1.0.136` -> `1.0.137` | | [serde_json](https://togithub.com/serde-rs/json) | dependencies | patch | `1.0.79` -> `1.0.81` | | [serde_yaml](https://togithub.com/dtolnay/serde-yaml) | dependencies | patch | `0.8.23` -> `0.8.24` | | [syn](https://togithub.com/dtolnay/syn) | dependencies | patch | `1.0.91` -> `1.0.96` | | [thiserror](https://togithub.com/dtolnay/thiserror) | dependencies | patch | `1.0.30` -> `1.0.31` | | [tokio](https://tokio.rs) ([source](https://togithub.com/tokio-rs/tokio)) | dependencies | patch | `1.18.0` -> `1.18.2` | --- ### Release Notes <details> <summary>clap-rs/clap</summary> ### [`v3.1.18`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​3118---2022-05-10) [Compare Source](https://togithub.com/clap-rs/clap/compare/v3.1.17...v3.1.18) ##### Fixes - Fix deprecated `arg_enum!` for users migrating to clap3 ([#​3717](https://togithub.com/clap-rs/clap/issues/3717)) - Verify all `required_unless_present_all` arguments exist - Verify group members exist before processing group members ([#​3711](https://togithub.com/clap-rs/clap/issues/3711)) - *(help)* Use `...` when not enough `value_names` are supplied **gated behind `unstable-v4`** - Verify `required` is not used with conditional required settings ([#​3660](https://togithub.com/clap-rs/clap/issues/3660)) - Disallow more `value_names` than `number_of_values` ([#​2695](https://togithub.com/clap-rs/clap/issues/2695)) - *(parser)* Assert on unknown args when using external subcommands ([#​3703](https://togithub.com/clap-rs/clap/issues/3703)) - *(parser)* Always fill in `""` argument for external subcommands ([#​3263](https://togithub.com/clap-rs/clap/issues/3263)) - *(derive)* Detect escaped external subcommands that look like built-in subcommands ([#​3703](https://togithub.com/clap-rs/clap/issues/3703)) - *(derive)* Leave `Arg::id` as `verbatim` casing ([#​3282](https://togithub.com/clap-rs/clap/issues/3282)) ### [`v3.1.17`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​3117---2022-05-06) [Compare Source](https://togithub.com/clap-rs/clap/compare/v3.1.16...v3.1.17) ##### Fixes - Allow value names for `arg!` macro to have dashes when quoted, like longs ### [`v3.1.16`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​3116---2022-05-06) [Compare Source](https://togithub.com/clap-rs/clap/compare/v3.1.15...v3.1.16) ##### Fixes - *(parser)* `Arg::exclusive` overrides `Arg::required`, like other conflicts - *(error)* Don't duplicate arguments in usage - *(error)* Don't show hidden arguments in conflict error usage - *(help)* New `help_template` variable `{name}` to fix problems with `{bin}` - *(help)* Don't wrap URLs **gated behind `unstable-v4`** - Leading dashes in `Arg::long` are no longer allowed - *(help)* Use `Command::display_name` in the help title rather than `Command::bin_name` ### [`v3.1.15`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​3115---2022-05-02) [Compare Source](https://togithub.com/clap-rs/clap/compare/v3.1.14...v3.1.15) ##### Fixes - *(error)* Render actual usage for unrecognized subcommands - *(multicall)* Improve bad command error - *(multicall)* Always require a multicall command - *(multicall)* Disallow arguments on multicall parent command - *(multicall)* More consistent with rest of clap errors ### [`v3.1.14`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​3114---2022-05-01) [Compare Source](https://togithub.com/clap-rs/clap/compare/v3.1.13...v3.1.14) ##### Fixes - Panic when calling `Command::build` with a required positional argument nested several layers in subcommands ### [`v3.1.13`](https://togithub.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​3113---2022-04-30) [Compare Source](https://togithub.com/clap-rs/clap/compare/v3.1.12...v3.1.13) ##### Fixes - Help subcommand and `Command::write_help` now report required arguments in usage in more circumstances - Unknown subcommand for help subcommand flag now reports an error with more context - More details reported when using `debug` feature - Allow disabling `color` feature with `debug` feature enabled </details> <details> <summary>rodrimati1992/const_format_crates</summary> ### [`v0.2.23`](https://togithub.com/rodrimati1992/const_format_crates/blob/HEAD/Changelog.md#​0223) Added type annotations to `concatp`, `concatcp`, `formatc` and `formatcp` macros to help IDEs infer the type. </details> <details> <summary>dtolnay/proc-macro2</summary> ### [`v1.0.39`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.39) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.38...1.0.39) - Replace unicode-xid with unicode-ident crate: https://github.com/dtolnay/unicode-ident ### [`v1.0.38`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.38) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.37...1.0.38) - Reduce allocations done by `Literal::byte_string` constructor ([#​328](https://togithub.com/dtolnay/proc-macro2/issues/328)) </details> <details> <summary>dtolnay/quote</summary> ### [`v1.0.18`](https://togithub.com/dtolnay/quote/compare/1.0.17...1.0.18) [Compare Source](https://togithub.com/dtolnay/quote/compare/1.0.17...1.0.18) </details> <details> <summary>rust-lang/regex</summary> ### [`v1.5.6`](https://togithub.com/rust-lang/regex/blob/HEAD/CHANGELOG.md#​156-2022-05-20) [Compare Source](https://togithub.com/rust-lang/regex/compare/1.5.5...1.5.6) \================== This release includes a few bug fixes, including a bug that produced incorrect matches when a non-greedy `?` operator was used. - [BUG #​680](https://togithub.com/rust-lang/regex/issues/680): Fixes a bug where `[[:alnum:][:^ascii:]]` dropped `[:alnum:]` from the class. - [BUG #​859](https://togithub.com/rust-lang/regex/issues/859): Fixes a bug where `Hir::is_match_empty` returned `false` for `\b`. - [BUG #​862](https://togithub.com/rust-lang/regex/issues/862): Fixes a bug where 'ab??' matches 'ab' instead of 'a' in 'ab'. </details> <details> <summary>GREsau/schemars</summary> ### [`v0.8.10`](https://togithub.com/GREsau/schemars/blob/HEAD/CHANGELOG.md#​0810---2022-05-17) [Compare Source](https://togithub.com/GREsau/schemars/compare/v0.8.9...v0.8.10) - Undo "Support generic default values in default attributes ([GREsau/schemars#83)" as it inadvertently introduced a breaking change ([GREsau/schemars#144) ### [`v0.8.9`](https://togithub.com/GREsau/schemars/blob/HEAD/CHANGELOG.md#​089---2022-05-16) [Compare Source](https://togithub.com/GREsau/schemars/compare/v0.8.8...v0.8.9) ##### Added: - \~~Support generic default values in `default` attributes ([GREsau/schemars#83 -⚠️ **This inadvertently introduced a breaking change and was removed in 0.8.10** - Add missing MIT licence text for usage of code from regex_syntax crate ([GREsau/schemars#132) - Support uuid v1 and arrayvec 0.7 via feature flags `uuid1` and `arrayvec07` ([GREsau/schemars#142) - This also adds `uuid08` and `arrayvec05` feature flags for the previously supported versions of these crates. The existing `uuid` and `arrayvec` flags are still supported for backward-compatibility, but they are **deprecated**. - Similarly, `indexmap1` feature flag is added, and `indexmap` flag is **deprecated**. </details> <details> <summary>serde-rs/serde</summary> ### [`v1.0.137`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.137) [Compare Source](https://togithub.com/serde-rs/serde/compare/v1.0.136...v1.0.137) - Update documentation links to some data formats whose repos have moved ([#​2201](https://togithub.com/serde-rs/serde/issues/2201), thanks [@​atouchet](https://togithub.com/atouchet)) - Fix declared `rust-version` of serde and serde_test ([#​2168](https://togithub.com/serde-rs/serde/issues/2168)) </details> <details> <summary>serde-rs/json</summary> ### [`v1.0.81`](https://togithub.com/serde-rs/json/releases/tag/v1.0.81) [Compare Source](https://togithub.com/serde-rs/json/compare/v1.0.80...v1.0.81) - Work around `indexmap`/`autocfg` not always properly detecting whether a `std` sysroot crate is available ([#​885](https://togithub.com/serde-rs/json/issues/885), thanks [@​cuviper](https://togithub.com/cuviper)) ### [`v1.0.80`](https://togithub.com/serde-rs/json/releases/tag/v1.0.80) [Compare Source](https://togithub.com/serde-rs/json/compare/v1.0.79...v1.0.80) - Documentation improvements </details> <details> <summary>dtolnay/serde-yaml</summary> ### [`v0.8.24`](https://togithub.com/dtolnay/serde-yaml/releases/tag/0.8.24) [Compare Source](https://togithub.com/dtolnay/serde-yaml/compare/0.8.23...0.8.24) - Work around `indexmap`/`autocfg` not always properly detecting whether a `std` sysroot crate is available ([#​243](https://togithub.com/dtolnay/serde-yaml/issues/243), thanks [@​cuviper](https://togithub.com/cuviper)) </details> <details> <summary>dtolnay/syn</summary> ### [`v1.0.96`](https://togithub.com/dtolnay/syn/releases/tag/1.0.96) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.95...1.0.96) - Add a `punct_mut()` method on `syn::punctuated::Pair` to return `Option<&mut P>` ([#​1183](https://togithub.com/dtolnay/syn/issues/1183)) ### [`v1.0.95`](https://togithub.com/dtolnay/syn/releases/tag/1.0.95) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.94...1.0.95) - Replace unicode-xid with unicode-ident crate: https://github.com/dtolnay/unicode-ident ### [`v1.0.94`](https://togithub.com/dtolnay/syn/releases/tag/1.0.94) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.93...1.0.94) - Resolve some unused_macro_rules warnings ### [`v1.0.93`](https://togithub.com/dtolnay/syn/releases/tag/1.0.93) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.92...1.0.93) - Fix compile error when `Some` means something unusual in the expression namespace of the scope where `custom_keyword` is invoked ([#​1171](https://togithub.com/dtolnay/syn/issues/1171), thanks [@​zakarumych](https://togithub.com/zakarumych)) ### [`v1.0.92`](https://togithub.com/dtolnay/syn/releases/tag/1.0.92) [Compare Source](https://togithub.com/dtolnay/syn/compare/1.0.91...1.0.92) - Make compatible with Miri's tag-raw-pointers mode ([#​1166](https://togithub.com/dtolnay/syn/issues/1166), thanks [@​saethlin](https://togithub.com/saethlin)) </details> <details> <summary>dtolnay/thiserror</summary> ### [`v1.0.31`](https://togithub.com/dtolnay/thiserror/releases/tag/1.0.31) [Compare Source](https://togithub.com/dtolnay/thiserror/compare/1.0.30...1.0.31) - Improve diagnostic when there is an enum variant containing `#[from] #[backtrace] Error, Backtrace` ([#​163](https://togithub.com/dtolnay/thiserror/issues/163)) </details> <details> <summary>tokio-rs/tokio</summary> ### [`v1.18.2`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.18.2) [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.18.1...tokio-1.18.2) ##### 1.18.2 (May 5, 2022) Add missing features for the `winapi` dependency. ([#​4663]) [#​4663]: https://togithub.com/tokio-rs/tokio/pull/4663 ### [`v1.18.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.18.1) [Compare Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.18.0...tokio-1.18.1) ##### 1.18.1 (May 2, 2022) The 1.18.0 release broke the build for targets without 64-bit atomics when building with `tokio_unstable`. This release fixes that. ([#​4649]) [#​4649]: https://togithub.com/tokio-rs/tokio/pull/4649 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 5:00 and before 6:00 every weekday" in timezone Europe/Berlin, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/stackabletech/operator-rs).
Schemars used to just serialize whatever default value it was given, but #83 requires that the type of each field's default must match the type of the field itself. This used to work fine in 0.8.8, but doesn't in 0.8.9:
I think this makes sense in theory, but it should at least have been published as the semver-incompatible 0.9.0 instead.
We (@stackabletech) also use this as an escape hatch to work around #137, so it'd be nice to get that working (I'd be happy to submit a PR if you'd be ok with what's outlined in that ticket), and/or keep some sort of escape hatch around.
(Co-discovered with @sbernauer)
The text was updated successfully, but these errors were encountered: