Skip to content

Commit 2756260

Browse files
authored
Integrate jiff date/time types (#1271, #1270)
- represent `jiff::civil::Date` as `LocalDate` GraphQL scalar - represent `jiff::civil::Time` as `LocalTime` GraphQL scalar - represent `jiff::civil::DateTime` as `LocalDateTime` GraphQL scalar - represent `jiff::Timestamp` as `DateTime` GraphQL scalar - represent `jiff::Span` as `Duration` GraphQL scalar
1 parent 975da45 commit 2756260

File tree

9 files changed

+763
-0
lines changed

9 files changed

+763
-0
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ jobs:
107107
- { feature: chrono-clock, crate: juniper }
108108
- { feature: chrono-tz, crate: juniper }
109109
- { feature: expose-test-schema, crate: juniper }
110+
- { feature: jiff, crate: juniper }
110111
- { feature: rust_decimal, crate: juniper }
111112
- { feature: schema-language, crate: juniper }
112113
- { feature: time, crate: juniper }

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ your Schemas automatically.
7373
- [url][url]
7474
- [chrono][chrono]
7575
- [chrono-tz][chrono-tz]
76+
- [jiff][jiff]
7677
- [time][time]
7778
- [bson][bson]
7879

@@ -119,6 +120,7 @@ Juniper has not reached 1.0 yet, thus some API instability should be expected.
119120
[url]: https://crates.io/crates/url
120121
[chrono]: https://crates.io/crates/chrono
121122
[chrono-tz]: https://crates.io/crates/chrono-tz
123+
[jiff]: https://crates.io/crates/jiff
122124
[time]: https://crates.io/crates/time
123125
[bson]: https://crates.io/crates/bson
124126
[juniper-from-schema]: https://github.com/davidpdrsn/juniper-from-schema

book/src/introduction.md

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Introduction
3131
- [`bigdecimal`]
3232
- [`bson`]
3333
- [`chrono`], [`chrono-tz`]
34+
- [`jiff`]
3435
- [`rust_decimal`]
3536
- [`time`]
3637
- [`url`]
@@ -63,6 +64,7 @@ Introduction
6364
[`bson`]: https://docs.rs/bson
6465
[`chrono`]: https://docs.rs/chrono
6566
[`chrono-tz`]: https://docs.rs/chrono-tz
67+
[`jiff`]: https://docs.rs/jiff
6668
[`juniper`]: https://docs.rs/juniper
6769
[`juniper_actix`]: https://docs.rs/juniper_actix
6870
[`juniper_axum`]: https://docs.rs/juniper_axum

book/src/types/scalars.md

+13
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@ mod date_scalar {
396396
| [`chrono::DateTime`] | [`DateTime`] | [`chrono`] |
397397
| [`chrono_tz::Tz`] | `TimeZone` | [`chrono-tz`] |
398398
| [`Decimal`] | `Decimal` | [`rust_decimal`] |
399+
| [`jiff::civil::Date`] | [`LocalDate`] | [`jiff`] |
400+
| [`jiff::civil::Time`] | [`LocalTime`] | [`jiff`] |
401+
| [`jiff::civil::DateTime`] | `LocalDateTime` | [`jiff`] |
402+
| [`jiff::Timestamp`] | [`DateTime`] | [`jiff`] |
403+
| [`jiff::Span`] | [`Duration`] | [`jiff`] |
399404
| [`time::Date`] | [`Date`] | [`time`] |
400405
| [`time::Time`] | [`LocalTime`] | [`time`] |
401406
| [`time::PrimitiveDateTime`] | `LocalDateTime` | [`time`] |
@@ -422,7 +427,15 @@ mod date_scalar {
422427
[`Date`]: https://graphql-scalars.dev/docs/scalars/date
423428
[`DateTime`]: https://graphql-scalars.dev/docs/scalars/date-time
424429
[`Decimal`]: https://docs.rs/rust_decimal/latest/rust_decimal/struct.Decimal.html
430+
[`Duration`]: https://graphql-scalars.dev/docs/scalars/duration
425431
[`ID`]: https://spec.graphql.org/October2021#sec-ID
432+
[`jiff`]: https://docs.rs/jiff
433+
[`jiff::civil::Date`]: https://docs.rs/jiff/latest/jiff/civil/struct.Date.html
434+
[`jiff::civil::DateTime`]: https://docs.rs/jiff/latest/jiff/civil/struct.DateTime.html
435+
[`jiff::civil::Time`]: https://docs.rs/jiff/latest/jiff/civil/struct.Time.html
436+
[`jiff::Span`]: https://docs.rs/jiff/latest/jiff/struct.Span.html
437+
[`jiff::Timestamp`]: https://docs.rs/jiff/latest/jiff/struct.Timestamp.html
438+
[`LocalDate`]: https://graphql-scalars.dev/docs/scalars/local-date
426439
[`LocalTime`]: https://graphql-scalars.dev/docs/scalars/local-time
427440
[`rust_decimal`]: https://docs.rs/rust_decimal
428441
[`ScalarValue`]: https://docs.rs/juniper/0.16.1/juniper/trait.ScalarValue.html

juniper/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
1515
- Upgraded [`chrono-tz` crate] integration to [0.9 version](https://github.com/chronotope/chrono-tz/releases/tag/v0.9.0). ([#1252])
1616
- Bumped up [MSRV] to 1.75. ([#1272])
1717

18+
### Added
19+
20+
- [`jiff` crate] integration behind `jiff` [Cargo feature]. ([#1271])
21+
1822
### Changed
1923

2024
- Updated [GraphiQL] to [3.5.0 version](https://github.com/graphql/graphiql/blob/graphiql%403.5.0/packages/graphiql/CHANGELOG.md#350). ([#1274])
2125

2226
[#1252]: /../../pull/1252
27+
[#1271]: /../../pull/1271
2328
[#1272]: /../../pull/1272
2429
[#1274]: /../../pull/1274
2530

@@ -222,6 +227,7 @@ See [old CHANGELOG](/../../blob/juniper-v0.15.12/juniper/CHANGELOG.md).
222227
[`bson` crate]: https://docs.rs/bson
223228
[`chrono` crate]: https://docs.rs/chrono
224229
[`chrono-tz` crate]: https://docs.rs/chrono-tz
230+
[`jiff` crate]: https://docs.rs/jiff
225231
[`time` crate]: https://docs.rs/time
226232
[Cargo feature]: https://doc.rust-lang.org/cargo/reference/features.html
227233
[`graphql-transport-ws` GraphQL over WebSocket Protocol]: https://github.com/enisdenjo/graphql-ws/v5.14.0/PROTOCOL.md

juniper/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ chrono = ["dep:chrono"]
3333
chrono-clock = ["chrono", "chrono/clock"]
3434
chrono-tz = ["dep:chrono-tz", "dep:regex"]
3535
expose-test-schema = ["dep:anyhow", "dep:serde_json"]
36+
jiff = ["dep:jiff"]
3637
js = ["chrono?/wasmbind", "time?/wasm-bindgen", "uuid?/js"]
3738
rust_decimal = ["dep:rust_decimal"]
3839
schema-language = ["dep:graphql-parser", "dep:void"]
@@ -52,6 +53,7 @@ fnv = "1.0.5"
5253
futures = { version = "0.3.22", features = ["alloc"], default-features = false }
5354
graphql-parser = { version = "0.4", optional = true }
5455
indexmap = { version = "2.0", features = ["serde"] }
56+
jiff = { version = "0.1.5", features = ["alloc"], default-features = false, optional = true }
5557
juniper_codegen = { version = "0.16.0", path = "../juniper_codegen" }
5658
rust_decimal = { version = "1.20", default-features = false, optional = true }
5759
ryu = { version = "1.0", optional = true }

juniper/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ As an exception to other [GraphQL] libraries for other languages, [Juniper] buil
4848
- [`bigdecimal`]
4949
- [`bson`]
5050
- [`chrono`], [`chrono-tz`]
51+
- [`jiff`]
5152
- [`rust_decimal`]
5253
- [`time`]
5354
- [`url`]
@@ -85,6 +86,7 @@ This project is licensed under [BSD 2-Clause License](https://github.com/graphql
8586
[`bson`]: https://docs.rs/bson
8687
[`chrono`]: https://docs.rs/chrono
8788
[`chrono-tz`]: https://docs.rs/chrono-tz
89+
[`jiff`]: https://docs.rs/jiff
8890
[`juniper_actix`]: https://docs.rs/juniper_actix
8991
[`juniper_axum`]: https://docs.rs/juniper_axum
9092
[`juniper_hyper`]: https://docs.rs/juniper_hyper

0 commit comments

Comments
 (0)