Skip to content

Commit

Permalink
fixup! Support jiff types
Browse files Browse the repository at this point in the history
Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun committed Jan 13, 2025
1 parent f67ad00 commit 3855539
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
18 changes: 18 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion schemars/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion schemars/src/json_schema_impls/jiff01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
9 changes: 6 additions & 3 deletions schemars/tests/integration/jiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"date_time_zoned": {
"type": "string",
"format": "date-time"
"format": "zoned-date-time"
},
"naive_date": {
"type": "string",
Expand Down

0 comments on commit 3855539

Please sign in to comment.