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 graphiql & upgrade version #2683

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
65 changes: 43 additions & 22 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions crates/torii/graphql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ version.workspace = true

[dependencies]
anyhow.workspace = true
async-graphql = { version = "6.0.7", features = [ "chrono", "dynamic-schema" ] }
async-graphql-warp = "6.0.7"
async-graphql = { version = "7.0.11", features = [ "chrono", "dynamic-schema" ] }
async-graphql-warp = "7.0.11"
async-recursion = "1.0.5"
base64.workspace = true
chrono.workspace = true
Expand Down
13 changes: 7 additions & 6 deletions crates/torii/graphql/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::net::SocketAddr;

use async_graphql::dynamic::Schema;
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig};
use async_graphql::http::GraphiQLSource;
use async_graphql::Request;
use async_graphql_warp::graphql_subscription;
use serde_json::json;
Expand Down Expand Up @@ -65,11 +65,12 @@
};

let playground_filter = warp::path("graphql").map(move || {
warp::reply::html(playground_source(
// NOTE: GraphQL Playground currently doesn't support relative urls for the
// subscription endpoint.
GraphQLPlaygroundConfig::new("").subscription_endpoint(subscription_endpoint.as_str()),
))
warp::reply::html(
GraphiQLSource::build()
.endpoint("/graphql")
.subscription_endpoint(subscription_endpoint.as_str())
.finish(),
)

Check warning on line 73 in crates/torii/graphql/src/server.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/graphql/src/server.rs#L68-L73

Added lines #L68 - L73 were not covered by tests
});

graphql_subscription(schema).or(graphql_post).or(playground_filter)
Expand Down
Loading