diff --git a/Cargo.lock b/Cargo.lock index b6b9a0a8..0390d7e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -411,9 +411,27 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed0ce60560149333a8e41ca7dc78799c47c5fd435e2bc18faf6a054382eec037" dependencies = [ + "jiff-tzdb-platform", + "log", "portable-atomic", "portable-atomic-util", "serde", + "windows-sys 0.52.0", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91335e575850c5c4c673b9bd467b0e025f164ca59d0564f69d0c2ee0ffad4653" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9835f0060a626fe59f160437bc725491a6af23133ea906500027d1bd2f8f4329" +dependencies = [ + "jiff-tzdb", ] [[package]] diff --git a/schemars/Cargo.toml b/schemars/Cargo.toml index ad8a4f06..8ae96d41 100644 --- a/schemars/Cargo.toml +++ b/schemars/Cargo.toml @@ -52,7 +52,7 @@ bytes1 = { version = "1.0", default-features = false, features = ["serde"], pack chrono04 = { version = "0.4", default-features = false, features = ["serde"], package = "chrono" } either1 = { version = "1.3", default-features = false, features = ["serde"], package = "either" } indexmap2 = { version = "2.0", default-features = false, features = ["serde"], package = "indexmap" } -jiff01 = { version = "0.1", default-features = false, features = ["serde"], package = "jiff" } +jiff01 = { version = "0.1", features = ["serde"], package = "jiff" } rust_decimal1 = { version = "1", default-features = false, features = ["serde"], package = "rust_decimal" } semver1 = { version = "1.0.9", default-features = false, features = ["serde"], package = "semver" } smallvec1 = { version = "1.0", default-features = false, features = ["serde"], package = "smallvec" } diff --git a/schemars/src/json_schema_impls/jiff01.rs b/schemars/src/json_schema_impls/jiff01.rs index ad1f60aa..047ed5a9 100644 --- a/schemars/src/json_schema_impls/jiff01.rs +++ b/schemars/src/json_schema_impls/jiff01.rs @@ -31,7 +31,7 @@ macro_rules! formatted_string_impl { formatted_string_impl!(SignedDuration, "duration"); formatted_string_impl!(Timestamp, "date-time"); -formatted_string_impl!(Zoned, "date-time"); +formatted_string_impl!(Zoned, "zoned-date-time"); formatted_string_impl!(Date, "date"); formatted_string_impl!(Time, "partial-time"); formatted_string_impl!(DateTime, "partial-date-time"); diff --git a/schemars/tests/integration/jiff.rs b/schemars/tests/integration/jiff.rs index e2db56c3..aacd8f43 100644 --- a/schemars/tests/integration/jiff.rs +++ b/schemars/tests/integration/jiff.rs @@ -19,9 +19,12 @@ fn jiff() { .assert_allows_ser_roundtrip_default() .assert_matches_de_roundtrip(arbitrary_values()); - // test!(Zoned) - // .assert_allows_ser_roundtrip_default() - // .assert_matches_de_roundtrip(arbitrary_values()); + test!(Zoned) + .assert_allows_ser_roundtrip_default() + .assert_matches_de_roundtrip(arbitrary_values_except( + Value::is_string, + "Custom format 'zoned-date-time', so arbitrary strings technically allowed by schema", + )); test!(Date) .assert_allows_ser_roundtrip_default() diff --git a/schemars/tests/integration/snapshots/schemars/tests/integration/jiff.rs~jiff.json b/schemars/tests/integration/snapshots/schemars/tests/integration/jiff.rs~jiff.json index 3a089e82..39e14989 100644 --- a/schemars/tests/integration/snapshots/schemars/tests/integration/jiff.rs~jiff.json +++ b/schemars/tests/integration/snapshots/schemars/tests/integration/jiff.rs~jiff.json @@ -9,7 +9,7 @@ }, "date_time_zoned": { "type": "string", - "format": "date-time" + "format": "zoned-date-time" }, "naive_date": { "type": "string",