Skip to content
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

feat: use ArcStr for storing strings in Schema #1247

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
3 changes: 1 addition & 2 deletions benches/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ impl Query {
}
}

pub fn new_schema() -> RootNode<'static, Query, EmptyMutation<Context>, EmptySubscription<Context>>
{
pub fn new_schema() -> RootNode<Query, EmptyMutation<Context>, EmptySubscription<Context>> {
RootNode::new(Query, EmptyMutation::new(), EmptySubscription::new())
}

Expand Down
4 changes: 2 additions & 2 deletions book/src/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl Mutation {

// Root schema consists of a query, a mutation, and a subscription.
// Request queries can be executed against a `RootNode`.
type Schema = juniper::RootNode<'static, Query, Mutation, EmptySubscription<Context>>;
type Schema = juniper::RootNode<Query, Mutation, EmptySubscription<Context>>;
#
# fn main() {
# _ = Schema::new(Query, Mutation, EmptySubscription::new());
Expand Down Expand Up @@ -190,7 +190,7 @@ impl Query {
}
}

type Schema = juniper::RootNode<'static, Query, EmptyMutation<Ctx>, EmptySubscription<Ctx>>;
type Schema = juniper::RootNode<Query, EmptyMutation<Ctx>, EmptySubscription<Ctx>>;

fn main() {
// Create a context.
Expand Down
4 changes: 2 additions & 2 deletions book/src/schema/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Mutation {
}
}

type Schema = RootNode<'static, Query, Mutation, EmptySubscription>;
type Schema = RootNode<Query, Mutation, EmptySubscription>;
#
# fn main() {}
```
Expand Down Expand Up @@ -138,7 +138,7 @@ impl Query {
}
}

type Schema = RootNode<'static, Query, EmptyMutation, EmptySubscription>;
type Schema = RootNode<Query, EmptyMutation, EmptySubscription>;

fn main() {
// Run the built-in introspection query.
Expand Down
2 changes: 1 addition & 1 deletion book/src/schema/introspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Query {
}
}

type Schema = RootNode<'static, Query, EmptyMutation, EmptySubscription>;
type Schema = RootNode<Query, EmptyMutation, EmptySubscription>;

fn main() {
let schema = Schema::new(Query, EmptyMutation::new(), EmptySubscription::new())
Expand Down
2 changes: 1 addition & 1 deletion book/src/schema/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ While we can implement [`SubscriptionCoordinator`] ourselves, [Juniper] contains
# }
# }
#
type Schema = RootNode<'static, Query, EmptyMutation<Database>, Subscription>;
type Schema = RootNode<Query, EmptyMutation<Database>, Subscription>;

fn schema() -> Schema {
Schema::new(Query, EmptyMutation::new(), Subscription)
Expand Down
17 changes: 14 additions & 3 deletions juniper/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,29 @@ All user visible changes to `juniper` crate will be documented in this file. Thi



## [0.17.0] · 2024-04-?? (unreleased)
[0.17.0]: /../../tree/juniper-v0.17.0/juniper
## master

[Diff](/../../compare/juniper-v0.16.1...juniper-v0.17.0) | [Milestone](/../../milestone/7)
[Diff](/../../compare/juniper-v0.16.1...master) | [Milestone](/../../milestone/7)

### BC Breaks

- Upgraded [`chrono-tz` crate] integration to [0.9 version](https://github.com/chronotope/chrono-tz/releases/tag/v0.9.0). ([#1252])
- Optimized schema implementation with [`arcstr` crate]: ([#1247], [#819])
- Removed lifetime parameters from `MetaType` and its members.
- Made `MetaType::name()`, `MetaType::description()` and `MetaType::specified_by_url()` returning `ArcStr`.
- Made `DeprecationStatus::reason()` returning `ArcStr`.
- Removed lifetime parameters from `DirectiveType`.
- Made `DirectiveType::name` and `DirectiveType::description` using `ArcStr`.
- Made `types::Name` and `types::NameParseError` using `ArcStr` instead of `String`.
- Made `GraphQLType::name()` and `GraphQLValue::type_name()` returning `ArcStr`.
- Removed lifetime parameters from `RootNode`.

### Changed

- Updated [GraphiQL] to [3.2.0 version](https://github.com/graphql/graphiql/blob/graphiql%403.2.0/packages/graphiql/CHANGELOG.md#320). ([#1253])

[#819]: /../../issues/819
[#1247]: /../../pull/1247
[#1252]: /../../pull/1252
[#1253]: /../../pull/1253

Expand Down Expand Up @@ -217,6 +227,7 @@ See [old CHANGELOG](/../../blob/juniper-v0.15.12/juniper/CHANGELOG.md).


[`anyhow` crate]: https://docs.rs/anyhow
[`arcstr` crate]: https://docs.rs/arcstr
[`bigdecimal` crate]: https://docs.rs/bigdecimal
[`bson` crate]: https://docs.rs/bson
[`chrono` crate]: https://docs.rs/chrono
Expand Down
2 changes: 1 addition & 1 deletion juniper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ uuid = ["dep:uuid"]

[dependencies]
anyhow = { version = "1.0.47", optional = true }
arcstr = { version = "1.1", default-features = false }
async-trait = "0.1.39"
auto_enums = "0.8"
bigdecimal = { version = "0.4", optional = true }
Expand All @@ -57,7 +58,6 @@ rust_decimal = { version = "1.20", default-features = false, optional = true }
ryu = { version = "1.0", optional = true }
serde = { version = "1.0.122", features = ["derive"] }
serde_json = { version = "1.0.18", features = ["std"], default-features = false, optional = true }
smartstring = "1.0"
static_assertions = "1.1"
time = { version = "0.3.35", features = ["formatting", "macros", "parsing"], optional = true }
url = { version = "2.0", optional = true }
Expand Down
Loading