Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GREsau/schemars
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.8.9
Choose a base ref
...
head repository: GREsau/schemars
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.8.10
Choose a head ref
  • 2 commits
  • 6 files changed
  • 1 contributor

Commits on May 17, 2022

  1. Revert "Support generic default values"

    This feature inadvertently introduced a breaking change (#144)
    
    This reverts commits: feb6c4b
    b38a553.
    GREsau committed May 17, 2022
    Copy the full SHA
    d93bdc4 View commit details
  2. v0.8.10

    GREsau committed May 17, 2022
    Copy the full SHA
    9464118 View commit details
Showing with 9 additions and 31 deletions.
  1. +5 −1 CHANGELOG.md
  2. +2 −2 schemars/Cargo.toml
  3. +0 −12 schemars/tests/default.rs
  4. +0 −14 schemars/tests/expected/generic_default.json
  5. +1 −1 schemars_derive/Cargo.toml
  6. +1 −1 schemars_derive/src/schema_exprs.rs
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changelog

## [0.8.10] - 2022-05-17
- Undo "Support generic default values in default attributes (https://github.com/GREsau/schemars/pull/83)" as it inadvertently introduced a breaking change (https://github.com/GREsau/schemars/issues/144)

## [0.8.9] - 2022-05-16
### Added:
- Support generic default values in `default` attributes (https://github.com/GREsau/schemars/pull/83)
- ~~Support generic default values in `default` attributes (https://github.com/GREsau/schemars/pull/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 (https://github.com/GREsau/schemars/pull/132)
- Support uuid v1 and arrayvec 0.7 via feature flags `uuid1` and `arrayvec07` (https://github.com/GREsau/schemars/pull/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**.
4 changes: 2 additions & 2 deletions schemars/Cargo.toml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ name = "schemars"
description = "Generate JSON Schemas from Rust code"
homepage = "https://graham.cool/schemars/"
repository = "https://github.com/GREsau/schemars"
version = "0.8.9"
version = "0.8.10"
authors = ["Graham Esau <gesau@hotmail.co.uk>"]
edition = "2018"
license = "MIT"
@@ -13,7 +13,7 @@ categories = ["encoding"]
build = "build.rs"

[dependencies]
schemars_derive = { version = "=0.8.9", optional = true, path = "../schemars_derive" }
schemars_derive = { version = "=0.8.10", optional = true, path = "../schemars_derive" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
dyn-clone = "1.0"
12 changes: 0 additions & 12 deletions schemars/tests/default.rs
Original file line number Diff line number Diff line change
@@ -56,15 +56,3 @@ struct NotSerialize;
fn schema_default_values() -> TestResult {
test_default_generated_schema::<MyStruct>("default")
}

#[allow(dead_code)]
#[derive(JsonSchema)]
struct StructWithGenericDefaults {
#[serde(default = "Vec::new")]
a_vec: Vec<String>,
}

#[test]
fn schema_with_generic_default_value() -> TestResult {
test_default_generated_schema::<StructWithGenericDefaults>("generic_default")
}
14 changes: 0 additions & 14 deletions schemars/tests/expected/generic_default.json

This file was deleted.

2 changes: 1 addition & 1 deletion schemars_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ name = "schemars_derive"
description = "Macros for #[derive(JsonSchema)], for use with schemars"
homepage = "https://graham.cool/schemars/"
repository = "https://github.com/GREsau/schemars"
version = "0.8.9"
version = "0.8.10"
authors = ["Graham Esau <gesau@hotmail.co.uk>"]
edition = "2018"
license = "MIT"
2 changes: 1 addition & 1 deletion schemars_derive/src/schema_exprs.rs
Original file line number Diff line number Diff line change
@@ -581,7 +581,7 @@ fn field_default_expr(field: &Field, container_has_default: bool) -> Option<Toke
quote!(container_default.#member)
}
SerdeDefault::Default => quote!(<#ty>::default()),
SerdeDefault::Path(path) => quote!({ #path() as #ty }),
SerdeDefault::Path(path) => quote!(#path()),
};

let default_expr = match field.serde_attrs.skip_serializing_if() {