Skip to content

Update chrono scalars according to the graphql-scalars.dev #1010

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

Merged
merged 118 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
01d7cb8
WIP
ilslv Dec 20, 2021
205cfcd
WIP
ilslv Dec 20, 2021
928cb9c
WIP (with IsSubtype)
ilslv Dec 20, 2021
3dad162
WIP (It looks like we're onto something)
ilslv Dec 20, 2021
af04486
WIP (return to const assertions)
ilslv Dec 21, 2021
4ae8c5d
Make `chrono` scalars similar to the `time`
ilslv Dec 23, 2021
279ae22
Remove FixedOffset scalar
ilslv Dec 23, 2021
bba4af8
Corrections
ilslv Dec 23, 2021
ecf9179
Merge branch 'master' into chrono-scalars
ilslv Dec 23, 2021
15e527f
It's alive!
ilslv Dec 24, 2021
cb9cad5
Merge branch 'master' into 1000-new-interfaces
ilslv Dec 24, 2021
7a78f9e
Use Field inside object's field resolver
ilslv Dec 24, 2021
5c2087c
Add async object fields
ilslv Dec 24, 2021
e9c6046
Fix
ilslv Dec 24, 2021
f2275a4
Corrections
tyranron Dec 25, 2021
0739c3e
Fix Wrapped type for tuple with context
ilslv Dec 27, 2021
263d544
WIP (Make graphql_interface_new attribute work)
ilslv Dec 28, 2021
f4c48a6
WIP (move to the new tests volume 1)
ilslv Dec 28, 2021
a1df387
WIP (move to the new tests volume 2)
ilslv Dec 29, 2021
5040d68
WIP (move to the new tests volume 3)
ilslv Dec 29, 2021
f5533e3
WIP (move to the new tests volume 4)
ilslv Dec 29, 2021
527325c
WIP (move to the new tests volume 5)
ilslv Dec 29, 2021
704f079
WIP (move to the new tests volume 5)
ilslv Dec 29, 2021
b84009e
WIP (refactor)
ilslv Dec 30, 2021
11345f7
WIP (refactor)
ilslv Dec 30, 2021
5e7230f
WIP (moving to readable const asserts)
ilslv Dec 30, 2021
d17ba4f
WIP (finally good const assert message)
ilslv Dec 30, 2021
8cb9b81
WIP (corrections)
ilslv Dec 30, 2021
116cdd9
WIP (pretty field arguments check)
ilslv Jan 3, 2022
7bd8c73
WIP (pretty subtype check)
ilslv Jan 3, 2022
3ebc8fd
WIP (corrections)
ilslv Jan 3, 2022
ce249b0
WIP (FieldMeta trait)
ilslv Jan 3, 2022
d9971a0
WIP (Refactor graphql_interface_new a bit)
ilslv Jan 3, 2022
8a966fb
WIP (Corrections)
ilslv Jan 3, 2022
21f4940
WIP (Prettify non-existent Field assertions)
ilslv Jan 4, 2022
e03901b
WIP (Move to macros::reflection module)
ilslv Jan 4, 2022
3ad8399
WIP (Docs vol. 1)
ilslv Jan 4, 2022
463bbb8
WIP (Docs vol. 2)
ilslv Jan 4, 2022
26ab27e
WIP (Refactoring)
ilslv Jan 4, 2022
cddb252
Merge branch 'master' into 1000-new-interfaces
ilslv Jan 4, 2022
9977746
WIP (Refactoring)
ilslv Jan 4, 2022
f5340a7
WIP (Tests corrections)
ilslv Jan 4, 2022
4c31c13
WIP (More tests vol. 1)
ilslv Jan 4, 2022
7bd09d0
WIP (Move everything to the new graphql_interface macro)
ilslv Jan 5, 2022
b5f552a
WIP (More codegen_fail tests)
ilslv Jan 5, 2022
66819e9
WIP (prettify missing references in `impl` and `for` attributes)
ilslv Jan 5, 2022
3d53dc1
WIP (more tests)
ilslv Jan 5, 2022
732bc13
WIP (Correct docs)
ilslv Jan 6, 2022
81d96ce
WIP (Forbid default trait method impls)
ilslv Jan 6, 2022
94164eb
WIP (Corrections)
ilslv Jan 6, 2022
1345bff
WIP (Corrections)
ilslv Jan 6, 2022
6cb5cef
WIP (Corrections)
ilslv Jan 6, 2022
41a2dcf
WIP (CHANGELOG)
ilslv Jan 6, 2022
eb8c56d
WIP (Correction)
ilslv Jan 6, 2022
7f45aef
WIP
ilslv Jan 10, 2022
81c4df9
Migrate to real GraphQLScalar trait
ilslv Jan 10, 2022
d359524
Corrections
ilslv Jan 10, 2022
888789a
Corrections
ilslv Jan 11, 2022
e28ca92
Add generic test and remove redundant lifetime
ilslv Jan 11, 2022
f531037
Some corrections [skip ci]
tyranron Jan 11, 2022
8f169cf
WIP
ilslv Jan 12, 2022
a2287dc
Minor tests corrections
ilslv Jan 12, 2022
ceb2cf6
Don't inject `#[async_trait]` in case some trait methods are async
ilslv Jan 12, 2022
d77a1ab
Corrections
ilslv Jan 13, 2022
8be555c
Merge branch '1000-new-interfaces' into generic-scalar
ilslv Jan 13, 2022
ebc0149
Merge branch 'generic-scalar' into new-derive-scalar
ilslv Jan 13, 2022
8fb4587
WIP
ilslv Jan 13, 2022
52c14b2
WIP
ilslv Jan 13, 2022
4b6df34
Corrections
ilslv Jan 14, 2022
0cb101d
Corrections
ilslv Jan 14, 2022
8d47ba7
Merge branch '1000-new-interfaces' into generic-scalar
ilslv Jan 14, 2022
22b3fe2
Merge branch 'generic-scalar' into new-derive-scalar
ilslv Jan 14, 2022
7635a1e
Corrections
ilslv Jan 14, 2022
3da33ba
Corrections
ilslv Jan 14, 2022
cc365d3
Corrections
ilslv Jan 14, 2022
30117a8
Docs and the book
ilslv Jan 14, 2022
2362b27
Fix The Book
ilslv Jan 14, 2022
193c77b
Merge branch 'master' into generic-scalar
ilslv Jan 28, 2022
86f1c10
CHANGELOG
ilslv Jan 28, 2022
7db2adc
Sprinkle `#[automatically_derived]` attributes
ilslv Jan 28, 2022
859b3be
Merge branch 'generic-scalar' into new-derive-scalar
ilslv Jan 28, 2022
6fb0dbf
Implement `#[graphql(with)]` attribute
ilslv Feb 2, 2022
f063728
CHANGELOG
ilslv Feb 2, 2022
10bea73
Implement `GraphQLScalarValue` derive macro
ilslv Feb 3, 2022
512f377
Add `codegen_fail` tests
ilslv Feb 3, 2022
60fcbbc
WIP
ilslv Feb 4, 2022
8b3e80a
Merge branch 'master' into new-derive-scalar
ilslv Feb 4, 2022
8706043
Corrections and tests
ilslv Feb 4, 2022
5b96861
Correction
ilslv Feb 4, 2022
81bb650
WIP
ilslv Feb 15, 2022
b4df74a
Corrections
ilslv Feb 15, 2022
2c5cf99
Merge branch 'new-derive-scalar' into derive-scalar-value
ilslv Feb 15, 2022
aed11f9
Corrections
ilslv Feb 15, 2022
a5cf713
CHANGELOG
ilslv Feb 15, 2022
5cc24db
CHANGELOG
ilslv Feb 15, 2022
8cea820
WIP
ilslv Feb 18, 2022
9c58419
Corrections
ilslv Feb 21, 2022
baad84b
Corrections
ilslv Feb 21, 2022
8ebd520
Merge branch 'new-derive-scalar' into derive-scalar-value
ilslv Feb 21, 2022
a2ecb44
Corrections
ilslv Feb 21, 2022
9144d02
Corrections
ilslv Feb 21, 2022
e58da4f
Merge branch 'derive-scalar-value' into chrono-scalars
ilslv Feb 24, 2022
173cddb
WIP
ilslv Feb 24, 2022
a7d4b28
Corrections
ilslv Feb 25, 2022
28bd546
Merge branch 'master' into derive-scalar-value
ilslv Mar 1, 2022
aa8a345
Corrections
ilslv Mar 1, 2022
b28cc4a
Merge branch 'derive-scalar-value' into chrono-scalars
ilslv Mar 1, 2022
641860b
Corrections
ilslv Mar 1, 2022
217258e
Merge branch 'master' into chrono-scalars
ilslv Mar 4, 2022
41bb059
Corrections
ilslv Mar 4, 2022
e0c820b
Corrections
ilslv Mar 4, 2022
c9ebc71
Fix actix beta versions
ilslv Mar 4, 2022
eb1db1e
Fix actix beta versions
ilslv Mar 4, 2022
09eee30
Update actix to stable
ilslv Mar 4, 2022
246573d
Corrections
ilslv Mar 4, 2022
6cea077
Fix `actix-web-actors` at `4.0.0`
ilslv Mar 4, 2022
d57b643
Corrections [run ci]
tyranron Mar 4, 2022
93a12c1
Corrections, vol.2
tyranron Mar 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/book/content/types/scalars.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ Juniper has built-in support for a few additional types from common third party
crates. They are enabled via features that are on by default.

* uuid::Uuid
* chrono::DateTime
* chrono::{DateTime, NaiveDate, NaiveDateTime, NaiveTime}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should update chrono-tz integration as well inside this PR.

* chrono_tz::Tz;
* time::{Date, OffsetDateTime, PrimitiveDateTime, Time, UtcOffset}
* url::Url
* bson::oid::ObjectId
Expand Down
4 changes: 2 additions & 2 deletions examples/actix_subscriptions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ authors = ["Mihai Dinculescu <[email protected]>"]
publish = false

[dependencies]
actix-web = "4.0.0-beta.12"
actix-cors = "0.6.0-beta.4"
actix-web = "4.0"
actix-cors = "0.6"
futures = "0.3"
env_logger = "0.9"
serde = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/actix_subscriptions/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ async fn main() -> std::io::Result<()> {
.route(web::get().to(graphql)),
)
.service(web::resource("/playground").route(web::get().to(playground)))
.default_service(web::route().to(|| {
.default_service(web::to(|| async {
HttpResponse::Found()
.append_header((header::LOCATION, "/playground"))
.finish()
Expand Down
3 changes: 3 additions & 0 deletions juniper/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
- Mirror `#[derive(GraphQLScalar)]` macro.
- Support usage on type aliases in case `#[derive(GraphQLScalar)]` isn't applicable because of [orphan rules](https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules).
- Rename `ScalarValue::as_boolean` to `ScalarValue::as_bool`. ([#1025](https://github.com/graphql-rust/juniper/pull/1025))
- Change [`chrono` crate](https://docs.rs/chrono) GraphQL scalars according to the [graphql-scalars.dev](https://graphql-scalars.dev). ([#1010](https://github.com/graphql-rust/juniper/pull/1010))
- Disable `chrono` feature by default. ([#1010](https://github.com/graphql-rust/juniper/pull/1010))
- Remove `scalar-naivetime` feature. ([#1010](https://github.com/graphql-rust/juniper/pull/1010))

## Features

Expand Down
3 changes: 1 addition & 2 deletions juniper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ travis-ci = { repository = "graphql-rust/juniper" }
[features]
default = [
"bson",
"chrono",
"schema-language",
"url",
"uuid",
]
chrono-clock = ["chrono", "chrono/clock"]
expose-test-schema = ["anyhow", "serde_json"]
graphql-parser-integration = ["graphql-parser"]
scalar-naivetime = []
schema-language = ["graphql-parser-integration"]

[dependencies]
Expand Down
7 changes: 2 additions & 5 deletions juniper/src/integrations/bson.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! GraphQL support for [bson](https://github.com/mongodb/bson-rust) types.

use chrono::prelude::*;

use crate::{graphql_scalar, InputValue, ScalarValue, Value};

#[graphql_scalar(with = object_id, parse_token(String))]
Expand Down Expand Up @@ -30,17 +28,16 @@ mod utc_date_time {
use super::*;

pub(super) fn to_output<S: ScalarValue>(v: &UtcDateTime) -> Value<S> {
Value::scalar((*v).to_chrono().to_rfc3339())
Value::scalar((*v).to_rfc3339_string())
}

pub(super) fn from_input<S: ScalarValue>(v: &InputValue<S>) -> Result<UtcDateTime, String> {
v.as_string_value()
.ok_or_else(|| format!("Expected `String`, found: {}", v))
.and_then(|s| {
s.parse::<DateTime<Utc>>()
UtcDateTime::parse_rfc3339_str(s)
.map_err(|e| format!("Failed to parse `UtcDateTime`: {}", e))
})
.map(UtcDateTime::from_chrono)
}
}

Expand Down
Loading