From 5f454e05c7c6e5ecd2445aad7cdcdb55fbe04a62 Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Fri, 10 Apr 2020 00:06:39 -1000 Subject: [PATCH] Move graphiql export location (#615) This fixes a TODO. --- juniper/CHANGELOG.md | 2 ++ juniper/src/lib.rs | 2 -- juniper_hyper/src/lib.rs | 2 +- juniper_iron/src/lib.rs | 2 +- juniper_rocket/src/lib.rs | 4 +++- juniper_rocket_async/src/lib.rs | 4 +++- juniper_warp/src/lib.rs | 2 +- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/juniper/CHANGELOG.md b/juniper/CHANGELOG.md index 4278e858..6f5afa1f 100644 --- a/juniper/CHANGELOG.md +++ b/juniper/CHANGELOG.md @@ -22,6 +22,8 @@ See [#569](https://github.com/graphql-rust/juniper/pull/569). ## Breaking Changes +- `juniper::graphiql` has moved to `juniper::http::graphiql` + - remove old `graphql_object!` macro, rename `object` proc macro to `graphql_object` - Remove deprecated `ScalarValue` custom derive (renamed to GraphQLScalarValue) diff --git a/juniper/src/lib.rs b/juniper/src/lib.rs index 77bacb29..4f08a099 100644 --- a/juniper/src/lib.rs +++ b/juniper/src/lib.rs @@ -142,8 +142,6 @@ mod validation; // https://github.com/rust-lang/cargo/issues/1520 pub mod http; pub mod integrations; -// TODO: remove this alias export in 0.10. (breaking change) -pub use crate::http::graphiql; #[cfg(all(test, not(feature = "expose-test-schema")))] mod tests; diff --git a/juniper_hyper/src/lib.rs b/juniper_hyper/src/lib.rs index 437f8d9f..8fe2bda4 100644 --- a/juniper_hyper/src/lib.rs +++ b/juniper_hyper/src/lib.rs @@ -117,7 +117,7 @@ async fn parse_post_req( pub async fn graphiql(graphql_endpoint: &str) -> Result, hyper::Error> { let mut resp = new_html_response(StatusCode::OK); // XXX: is the call to graphiql_source blocking? - *resp.body_mut() = Body::from(juniper::graphiql::graphiql_source(graphql_endpoint)); + *resp.body_mut() = Body::from(juniper::http::graphiql::graphiql_source(graphql_endpoint)); Ok(resp) } diff --git a/juniper_iron/src/lib.rs b/juniper_iron/src/lib.rs index 8f0ab075..fc2ba9d1 100644 --- a/juniper_iron/src/lib.rs +++ b/juniper_iron/src/lib.rs @@ -326,7 +326,7 @@ impl Handler for GraphiQLHandler { Ok(Response::with(( content_type, status::Ok, - juniper::graphiql::graphiql_source(&self.graphql_url), + juniper::http::graphiql::graphiql_source(&self.graphql_url), ))) } } diff --git a/juniper_rocket/src/lib.rs b/juniper_rocket/src/lib.rs index e50350f7..c4a027c5 100644 --- a/juniper_rocket/src/lib.rs +++ b/juniper_rocket/src/lib.rs @@ -72,7 +72,9 @@ pub struct GraphQLResponse(pub Status, pub String); /// Generate an HTML page containing GraphiQL pub fn graphiql_source(graphql_endpoint_url: &str) -> content::Html { - content::Html(juniper::graphiql::graphiql_source(graphql_endpoint_url)) + content::Html(juniper::http::graphiql::graphiql_source( + graphql_endpoint_url, + )) } /// Generate an HTML page containing GraphQL Playground diff --git a/juniper_rocket_async/src/lib.rs b/juniper_rocket_async/src/lib.rs index edd4e279..892311c5 100644 --- a/juniper_rocket_async/src/lib.rs +++ b/juniper_rocket_async/src/lib.rs @@ -72,7 +72,9 @@ pub struct GraphQLResponse(pub Status, pub String); /// Generate an HTML page containing GraphiQL pub fn graphiql_source(graphql_endpoint_url: &str) -> content::Html { - content::Html(juniper::graphiql::graphiql_source(graphql_endpoint_url)) + content::Html(juniper::http::graphiql::graphiql_source( + graphql_endpoint_url, + )) } /// Generate an HTML page containing GraphQL Playground diff --git a/juniper_warp/src/lib.rs b/juniper_warp/src/lib.rs index 458c9fac..19f4591a 100644 --- a/juniper_warp/src/lib.rs +++ b/juniper_warp/src/lib.rs @@ -312,7 +312,7 @@ pub fn graphiql_filter( fn graphiql_response(graphql_endpoint_url: &'static str) -> warp::http::Response> { warp::http::Response::builder() .header("content-type", "text/html;charset=utf-8") - .body(juniper::graphiql::graphiql_source(graphql_endpoint_url).into_bytes()) + .body(juniper::http::graphiql::graphiql_source(graphql_endpoint_url).into_bytes()) .expect("response is valid") }