Remove async
feature gate (#554)
This still has the async / non-async split. Future diffs will get rid of `GraphQLTypeAsync` and move everything into `GraphQLType`.
This commit is contained in:
parent
15e9bffa84
commit
00b111a1ff
40 changed files with 18 additions and 423 deletions
|
@ -86,13 +86,4 @@ private = true
|
||||||
condition = { env_set = [ "RELEASE_LEVEL" ] }
|
condition = { env_set = [ "RELEASE_LEVEL" ] }
|
||||||
description = "Run `cargo-release` for every crate, but only make changes locally"
|
description = "Run `cargo-release` for every crate, but only make changes locally"
|
||||||
command = "cargo-release"
|
command = "cargo-release"
|
||||||
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/../_build/release.toml", "--no-confirm", "--skip-publish", "--skip-push", "--skip-tag", "${RELEASE_LEVEL}"]
|
args = ["release", "--config", "${CARGO_MAKE_WORKING_DIRECTORY}/../_build/release.toml", "--no-confirm", "--skip-publish", "--skip-push", "--skip-tag", "${RELEASE_LEVEL}"]
|
||||||
|
|
||||||
[tasks.test-verbose]
|
|
||||||
dependencies = ["test-async-verbose"]
|
|
||||||
|
|
||||||
[tasks.test-async-verbose]
|
|
||||||
description = "Runs cargo test with async feature"
|
|
||||||
category = "Test"
|
|
||||||
command = "cargo"
|
|
||||||
args = ["test", "--verbose", "--features", "async", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )"]
|
|
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
juniper = { path = "../../../juniper", features = ["async"] }
|
juniper = { path = "../../../juniper" }
|
||||||
juniper_iron = { path = "../../../juniper_iron" }
|
juniper_iron = { path = "../../../juniper_iron" }
|
||||||
futures = "0.3.1"
|
futures = "0.3.1"
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,7 @@ version = "0.1.0"
|
||||||
authors = ["Christoph Herzog <chris@theduke.at>"]
|
authors = ["Christoph Herzog <chris@theduke.at>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[features]
|
|
||||||
async = []
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
juniper = { path = "../../juniper", features = ["async"] }
|
juniper = { path = "../../juniper" }
|
||||||
futures = "0.3.1"
|
futures = "0.3.1"
|
||||||
tokio = { version = "0.2", features = ["rt-core", "time", "macros"] }
|
tokio = { version = "0.2", features = ["rt-core", "time", "macros"] }
|
|
@ -4,12 +4,9 @@ version = "0.1.0"
|
||||||
publish = false
|
publish = false
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[features]
|
|
||||||
async = ["juniper/async", "futures"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
juniper = { path = "../../juniper" }
|
juniper = { path = "../../juniper" }
|
||||||
futures = { version = "0.3.1", optional = true }
|
futures = "0.3.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serde_json = { version = "1" }
|
serde_json = { version = "1" }
|
||||||
|
|
|
@ -4,7 +4,6 @@ use fnv::FnvHashMap;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use juniper::{self, DefaultScalarValue, FromInputValue, GraphQLType, InputValue, ToInputValue};
|
use juniper::{self, DefaultScalarValue, FromInputValue, GraphQLType, InputValue, ToInputValue};
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use futures;
|
use futures;
|
||||||
|
|
||||||
#[derive(juniper::GraphQLEnum, Debug, PartialEq)]
|
#[derive(juniper::GraphQLEnum, Debug, PartialEq)]
|
||||||
|
|
|
@ -7,7 +7,6 @@ use juniper::{DefaultScalarValue, GraphQLObject};
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use juniper::{self, execute, EmptyMutation, GraphQLType, RootNode, Value, Variables};
|
use juniper::{self, execute, EmptyMutation, GraphQLType, RootNode, Value, Variables};
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use futures;
|
use futures;
|
||||||
|
|
||||||
#[derive(GraphQLObject, Debug, PartialEq)]
|
#[derive(GraphQLObject, Debug, PartialEq)]
|
||||||
|
|
|
@ -9,7 +9,6 @@ use juniper::{
|
||||||
GraphQLType, RootNode, Value, Variables,
|
GraphQLType, RootNode, Value, Variables,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use futures;
|
use futures;
|
||||||
|
|
||||||
pub struct Query;
|
pub struct Query;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use futures;
|
use futures;
|
||||||
|
|
||||||
// Trait.
|
// Trait.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use futures;
|
use futures;
|
||||||
use juniper::{DefaultScalarValue, FromInputValue, GraphQLType, InputValue, ToInputValue};
|
use juniper::{DefaultScalarValue, FromInputValue, GraphQLType, InputValue, ToInputValue};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use futures;
|
use futures;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Original author of this test is <https://github.com/davidpdrsn>.
|
// Original author of this test is <https://github.com/davidpdrsn>.
|
||||||
use juniper::*;
|
use juniper::*;
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use futures;
|
use futures;
|
||||||
|
|
||||||
pub struct Context;
|
pub struct Context;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Original author of this test is <https://github.com/davidpdrsn>.
|
// Original author of this test is <https://github.com/davidpdrsn>.
|
||||||
use juniper::*;
|
use juniper::*;
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use futures;
|
use futures;
|
||||||
|
|
||||||
struct Query;
|
struct Query;
|
||||||
|
|
|
@ -24,7 +24,6 @@ harness = false
|
||||||
path = "benches/bench.rs"
|
path = "benches/bench.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
async = ["juniper_codegen/async", "futures"]
|
|
||||||
expose-test-schema = []
|
expose-test-schema = []
|
||||||
default = [
|
default = [
|
||||||
"bson",
|
"bson",
|
||||||
|
@ -39,7 +38,7 @@ juniper_codegen = { version = "0.14.2", path = "../juniper_codegen" }
|
||||||
bson = { version = "0.14.0", optional = true }
|
bson = { version = "0.14.0", optional = true }
|
||||||
chrono = { version = "0.4.0", optional = true }
|
chrono = { version = "0.4.0", optional = true }
|
||||||
fnv = "1.0.3"
|
fnv = "1.0.3"
|
||||||
futures = { version = "0.3.1", optional = true }
|
futures = "0.3.1"
|
||||||
indexmap = { version = "1.0.0", features = ["serde-1"] }
|
indexmap = { version = "1.0.0", features = ["serde-1"] }
|
||||||
serde = { version = "1.0.8" }
|
serde = { version = "1.0.8" }
|
||||||
serde_derive = { version = "1.0.2" }
|
serde_derive = { version = "1.0.2" }
|
||||||
|
|
|
@ -372,7 +372,6 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve a single arbitrary value into an `ExecutionResult`
|
/// Resolve a single arbitrary value into an `ExecutionResult`
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub async fn resolve_async<T>(&self, info: &T::TypeInfo, value: &T) -> ExecutionResult<S>
|
pub async fn resolve_async<T>(&self, info: &T::TypeInfo, value: &T) -> ExecutionResult<S>
|
||||||
where
|
where
|
||||||
T: crate::GraphQLTypeAsync<S, Context = CtxT> + Send + Sync,
|
T: crate::GraphQLTypeAsync<S, Context = CtxT> + Send + Sync,
|
||||||
|
@ -386,7 +385,6 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve a single arbitrary value, mapping the context to a new type
|
/// Resolve a single arbitrary value, mapping the context to a new type
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub async fn resolve_with_ctx_async<NewCtxT, T>(
|
pub async fn resolve_with_ctx_async<NewCtxT, T>(
|
||||||
&self,
|
&self,
|
||||||
info: &T::TypeInfo,
|
info: &T::TypeInfo,
|
||||||
|
@ -421,7 +419,6 @@ where
|
||||||
/// Resolve a single arbitrary value into a return value
|
/// Resolve a single arbitrary value into a return value
|
||||||
///
|
///
|
||||||
/// If the field fails to resolve, `null` will be returned.
|
/// If the field fails to resolve, `null` will be returned.
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub async fn resolve_into_value_async<T>(&self, info: &T::TypeInfo, value: &T) -> Value<S>
|
pub async fn resolve_into_value_async<T>(&self, info: &T::TypeInfo, value: &T) -> Value<S>
|
||||||
where
|
where
|
||||||
T: crate::GraphQLTypeAsync<S, Context = CtxT> + Send + Sync,
|
T: crate::GraphQLTypeAsync<S, Context = CtxT> + Send + Sync,
|
||||||
|
@ -747,7 +744,6 @@ where
|
||||||
Ok((value, errors))
|
Ok((value, errors))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub async fn execute_validated_query_async<'a, 'b, QueryT, MutationT, CtxT, S>(
|
pub async fn execute_validated_query_async<'a, 'b, QueryT, MutationT, CtxT, S>(
|
||||||
document: &'b Document<'a, S>,
|
document: &'b Document<'a, S>,
|
||||||
operation: &'b Spanning<Operation<'_, S>>,
|
operation: &'b Spanning<Operation<'_, S>>,
|
||||||
|
|
|
@ -5,8 +5,7 @@ mod introspection;
|
||||||
mod variables;
|
mod variables;
|
||||||
|
|
||||||
// FIXME: re-enable
|
// FIXME: re-enable
|
||||||
#[cfg(not(feature = "async"))]
|
#[cfg(TODO)]
|
||||||
mod interfaces_unions;
|
mod interfaces_unions;
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
mod async_await;
|
mod async_await;
|
||||||
|
|
|
@ -93,7 +93,6 @@ where
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub async fn execute_async<'a, CtxT, QueryT, MutationT>(
|
pub async fn execute_async<'a, CtxT, QueryT, MutationT>(
|
||||||
&'a self,
|
&'a self,
|
||||||
root_node: &'a RootNode<'a, QueryT, MutationT, S>,
|
root_node: &'a RootNode<'a, QueryT, MutationT, S>,
|
||||||
|
|
|
@ -184,7 +184,6 @@ pub use crate::{
|
||||||
/// A pinned, boxed future that can be polled.
|
/// A pinned, boxed future that can be polled.
|
||||||
pub type BoxFuture<'a, T> = std::pin::Pin<Box<dyn std::future::Future<Output = T> + 'a + Send>>;
|
pub type BoxFuture<'a, T> = std::pin::Pin<Box<dyn std::future::Future<Output = T> + 'a + Send>>;
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub use crate::types::async_await::GraphQLTypeAsync;
|
pub use crate::types::async_await::GraphQLTypeAsync;
|
||||||
|
|
||||||
/// An error that prevented query execution
|
/// An error that prevented query execution
|
||||||
|
@ -258,7 +257,6 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Execute a query in a provided schema
|
/// Execute a query in a provided schema
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub async fn execute_async<'a, S, CtxT, QueryT, MutationT>(
|
pub async fn execute_async<'a, S, CtxT, QueryT, MutationT>(
|
||||||
document_source: &'a str,
|
document_source: &'a str,
|
||||||
operation_name: Option<&str>,
|
operation_name: Option<&str>,
|
||||||
|
|
|
@ -42,307 +42,6 @@
|
||||||
/// In addition to implementing `GraphQLType` for the type in question,
|
/// In addition to implementing `GraphQLType` for the type in question,
|
||||||
/// `FromInputValue` and `ToInputValue` is also implemented. This makes the type
|
/// `FromInputValue` and `ToInputValue` is also implemented. This makes the type
|
||||||
/// usable as arguments and default values.
|
/// usable as arguments and default values.
|
||||||
#[cfg(not(feature = "async"))]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! graphql_scalar {
|
|
||||||
( @as_expr $e:expr) => { $e };
|
|
||||||
|
|
||||||
(
|
|
||||||
@generate,
|
|
||||||
meta = {
|
|
||||||
name = $name:ty,
|
|
||||||
outname = {$($outname:tt)+},
|
|
||||||
scalar = {$($scalar:tt)+},
|
|
||||||
$(description = $descr:tt,)*
|
|
||||||
},
|
|
||||||
resolve = {
|
|
||||||
self_var = $resolve_self_var:ident,
|
|
||||||
body = $resolve_body: block,
|
|
||||||
return_type = $resolve_retun_type: ty,
|
|
||||||
},
|
|
||||||
from_input_value = {
|
|
||||||
arg = $from_input_value_arg: ident,
|
|
||||||
result = $from_input_value_result: ty,
|
|
||||||
body = $from_input_value_body: block,
|
|
||||||
},
|
|
||||||
from_str = {
|
|
||||||
value_arg = $from_str_arg: ident,
|
|
||||||
result = $from_str_result: ty,
|
|
||||||
body = $from_str_body: block,
|
|
||||||
lifetime = $from_str_lt: tt,
|
|
||||||
},
|
|
||||||
|
|
||||||
) => {
|
|
||||||
$crate::__juniper_impl_trait!(
|
|
||||||
impl <$($scalar)+> GraphQLType for $name {
|
|
||||||
type Context = ();
|
|
||||||
type TypeInfo = ();
|
|
||||||
|
|
||||||
fn name(_: &Self::TypeInfo) -> Option<&str> {
|
|
||||||
Some($crate::graphql_scalar!(@as_expr $($outname)+))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn meta<'r>(
|
|
||||||
info: &Self::TypeInfo,
|
|
||||||
registry: &mut $crate::Registry<'r, $crate::__juniper_insert_generic!($($scalar)+)>
|
|
||||||
) -> $crate::meta::MetaType<'r, $crate::__juniper_insert_generic!($($scalar)+)>
|
|
||||||
where
|
|
||||||
$crate::__juniper_insert_generic!($($scalar)+): 'r
|
|
||||||
{
|
|
||||||
let meta = registry.build_scalar_type::<Self>(info);
|
|
||||||
$(
|
|
||||||
let meta = meta.description($descr);
|
|
||||||
)*
|
|
||||||
meta.into_meta()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn resolve(
|
|
||||||
&$resolve_self_var,
|
|
||||||
_: &(),
|
|
||||||
_: Option<&[$crate::Selection<$crate::__juniper_insert_generic!($($scalar)+)>]>,
|
|
||||||
_: &$crate::Executor<
|
|
||||||
Self::Context,
|
|
||||||
$crate::__juniper_insert_generic!($($scalar)+)
|
|
||||||
>) -> $crate::ExecutionResult<$crate::__juniper_insert_generic!($($scalar)+)> {
|
|
||||||
Ok($resolve_body)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$crate::__juniper_impl_trait!(
|
|
||||||
impl<$($scalar)+> ToInputValue for $name {
|
|
||||||
fn to_input_value(&$resolve_self_var) -> $crate::InputValue<$crate::__juniper_insert_generic!($($scalar)+)> {
|
|
||||||
let v = $resolve_body;
|
|
||||||
$crate::ToInputValue::to_input_value(&v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$crate::__juniper_impl_trait!(
|
|
||||||
impl<$($scalar)+> FromInputValue for $name {
|
|
||||||
fn from_input_value(
|
|
||||||
$from_input_value_arg: &$crate::InputValue<$crate::__juniper_insert_generic!($($scalar)+)>
|
|
||||||
) -> $from_input_value_result {
|
|
||||||
$from_input_value_body
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$crate::__juniper_impl_trait!(
|
|
||||||
impl<$($scalar)+> ParseScalarValue for $name {
|
|
||||||
fn from_str<$from_str_lt>($from_str_arg: $crate::parser::ScalarToken<$from_str_lt>) -> $from_str_result {
|
|
||||||
$from_str_body
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// No more items to parse
|
|
||||||
(
|
|
||||||
@parse_functions,
|
|
||||||
meta = {
|
|
||||||
name = $name:ty,
|
|
||||||
outname = {$($outname:tt)+},
|
|
||||||
scalar = {$($scalar:tt)+},
|
|
||||||
$(description = $descr:tt,)*
|
|
||||||
},
|
|
||||||
resolve = {$($resolve_body:tt)+},
|
|
||||||
from_input_value = {$($from_input_value_body:tt)+},
|
|
||||||
from_str = {$($from_str_body:tt)+},
|
|
||||||
rest =
|
|
||||||
) => {
|
|
||||||
$crate::graphql_scalar!(
|
|
||||||
@generate,
|
|
||||||
meta = {
|
|
||||||
name = $name,
|
|
||||||
outname = {$($outname)+},
|
|
||||||
scalar = {$($scalar)+},
|
|
||||||
$(description = $descr,)*
|
|
||||||
},
|
|
||||||
resolve = {$($resolve_body)+},
|
|
||||||
from_input_value = {$($from_input_value_body)+},
|
|
||||||
from_str = {$($from_str_body)+},
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
(
|
|
||||||
@parse_functions,
|
|
||||||
meta = {
|
|
||||||
name = $name:ty,
|
|
||||||
outname = {$($outname:tt)+},
|
|
||||||
scalar = {$($scalar:tt)+},
|
|
||||||
$(description = $descr:tt,)*
|
|
||||||
},
|
|
||||||
$(from_input_value = {$($from_input_value_body:tt)+})*,
|
|
||||||
$(from_str = {$($from_str_body:tt)+})*,
|
|
||||||
rest =
|
|
||||||
) => {
|
|
||||||
compile_error!("Missing resolve function");
|
|
||||||
};
|
|
||||||
|
|
||||||
(
|
|
||||||
@parse_functions,
|
|
||||||
meta = {
|
|
||||||
name = $name:ty,
|
|
||||||
outname = {$($outname:tt)+},
|
|
||||||
scalar = {$($scalar:tt)+},
|
|
||||||
$(description = $descr:tt,)*
|
|
||||||
},
|
|
||||||
resolve = {$($resolve_body:tt)+},
|
|
||||||
$(from_str = {$($from_str_body:tt)+})*,
|
|
||||||
rest =
|
|
||||||
) => {
|
|
||||||
compile_error!("Missing from_input_value function");
|
|
||||||
};
|
|
||||||
|
|
||||||
(
|
|
||||||
@parse_functions,
|
|
||||||
meta = {
|
|
||||||
name = $name:ty,
|
|
||||||
outname = {$($outname:tt)+},
|
|
||||||
scalar = {$($scalar:tt)+},
|
|
||||||
$(description = $descr:tt,)*
|
|
||||||
},
|
|
||||||
resolve = {$($resolve_body:tt)+},
|
|
||||||
from_input_value = {$($from_input_value_body:tt)+},
|
|
||||||
rest =
|
|
||||||
) =>{
|
|
||||||
compile_error!("Missing from_str function");
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// resolve(&self) -> Value { ... }
|
|
||||||
(
|
|
||||||
@parse_functions,
|
|
||||||
meta = {$($meta:tt)*},
|
|
||||||
$(resolve = {$($resolve_body:tt)+},)*
|
|
||||||
$(from_input_value = {$($from_input_value_body:tt)+},)*
|
|
||||||
$(from_str = {$($from_str_body:tt)+},)*
|
|
||||||
rest = resolve(&$selfvar:ident) -> $return_ty:ty $body:block $($rest:tt)*
|
|
||||||
) => {
|
|
||||||
$crate::graphql_scalar!(
|
|
||||||
@parse_functions,
|
|
||||||
meta = {$($meta)*},
|
|
||||||
resolve = {
|
|
||||||
self_var = $selfvar,
|
|
||||||
body = $body,
|
|
||||||
return_type = $return_ty,
|
|
||||||
},
|
|
||||||
$(from_input_value = {$($from_input_value_body)+},)*
|
|
||||||
$(from_str = {$($from_str_body)+},)*
|
|
||||||
rest = $($rest)*
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// from_input_value(arg: &InputValue) -> ... { ... }
|
|
||||||
(
|
|
||||||
@parse_functions,
|
|
||||||
meta = { $($meta:tt)* },
|
|
||||||
$(resolve = {$($resolve_body:tt)+})*,
|
|
||||||
$(from_input_value = {$($from_input_value_body:tt)+},)*
|
|
||||||
$(from_str = {$($from_str_body:tt)+},)*
|
|
||||||
rest = from_input_value($arg:ident: &InputValue) -> $result:ty $body:block $($rest:tt)*
|
|
||||||
) => {
|
|
||||||
$crate::graphql_scalar!(
|
|
||||||
@parse_functions,
|
|
||||||
meta = { $($meta)* },
|
|
||||||
$(resolve = {$($resolve_body)+},)*
|
|
||||||
from_input_value = {
|
|
||||||
arg = $arg,
|
|
||||||
result = $result,
|
|
||||||
body = $body,
|
|
||||||
},
|
|
||||||
$(from_str = {$($from_str_body)+},)*
|
|
||||||
rest = $($rest)*
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// from_str(value: &str) -> Result<S, ParseError>
|
|
||||||
(
|
|
||||||
@parse_functions,
|
|
||||||
meta = { $($meta:tt)* },
|
|
||||||
$(resolve = {$($resolve_body:tt)+},)*
|
|
||||||
$(from_input_value = {$($from_input_value_body:tt)+},)*
|
|
||||||
$(from_str = {$($from_str_body:tt)+},)*
|
|
||||||
rest = from_str<$from_str_lt: tt>($value_arg:ident: ScalarToken<$ignored_lt2: tt>) -> $result:ty $body:block $($rest:tt)*
|
|
||||||
) => {
|
|
||||||
$crate::graphql_scalar!(
|
|
||||||
@parse_functions,
|
|
||||||
meta = { $($meta)* },
|
|
||||||
$(resolve = {$($resolve_body)+},)*
|
|
||||||
$(from_input_value = {$($from_input_value_body)+},)*
|
|
||||||
from_str = {
|
|
||||||
value_arg = $value_arg,
|
|
||||||
result = $result,
|
|
||||||
body = $body,
|
|
||||||
lifetime = $from_str_lt,
|
|
||||||
},
|
|
||||||
rest = $($rest)*
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// description: <description>
|
|
||||||
(
|
|
||||||
@parse_functions,
|
|
||||||
meta = {
|
|
||||||
name = $name:ty,
|
|
||||||
outname = {$($outname:tt)+},
|
|
||||||
scalar = {$($scalar:tt)+},
|
|
||||||
},
|
|
||||||
$(resolve = {$($resolve_body:tt)+},)*
|
|
||||||
$(from_input_value = {$($from_input_value_body:tt)+},)*
|
|
||||||
$(from_str = {$($from_str_body:tt)+},)*
|
|
||||||
rest = description: $descr:tt $($rest:tt)*
|
|
||||||
) => {
|
|
||||||
$crate::graphql_scalar!(
|
|
||||||
@parse_functions,
|
|
||||||
meta = {
|
|
||||||
name = $name,
|
|
||||||
outname = {$($outname)+},
|
|
||||||
scalar = {$($scalar)+},
|
|
||||||
description = $descr,
|
|
||||||
},
|
|
||||||
$(resolve = {$($resolve_body)+},)*
|
|
||||||
$(from_input_value = {$($from_input_value_body)+},)*
|
|
||||||
$(from_str = {$($from_str_body)+},)*
|
|
||||||
rest = $($rest)*
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
(
|
|
||||||
@parse,
|
|
||||||
meta = {
|
|
||||||
lifetimes = [],
|
|
||||||
name = $name: ty,
|
|
||||||
outname = {$($outname:tt)*},
|
|
||||||
scalar = {$($scalar:tt)*},
|
|
||||||
},
|
|
||||||
rest = $($rest:tt)*
|
|
||||||
) => {
|
|
||||||
$crate::graphql_scalar!(
|
|
||||||
@parse_functions,
|
|
||||||
meta = {
|
|
||||||
name = $name,
|
|
||||||
outname = {$($outname)*},
|
|
||||||
scalar = {$($scalar)*},
|
|
||||||
},
|
|
||||||
rest = $($rest)*
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
(@$($stuff:tt)*) => {
|
|
||||||
compile_error!("Invalid syntax for `graphql_scalar!`");
|
|
||||||
};
|
|
||||||
|
|
||||||
($($rest:tt)*) => {
|
|
||||||
$crate::__juniper_parse_object_header!(
|
|
||||||
callback = graphql_scalar,
|
|
||||||
rest = $($rest)*
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: prevent duplicating the whole macro for async.
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! graphql_scalar {
|
macro_rules! graphql_scalar {
|
||||||
( @as_expr $e:expr) => { $e };
|
( @as_expr $e:expr) => { $e };
|
||||||
|
|
|
@ -75,7 +75,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
impl<'a, CtxT, S, QueryT, MutationT> crate::GraphQLTypeAsync<S>
|
impl<'a, CtxT, S, QueryT, MutationT> crate::GraphQLTypeAsync<S>
|
||||||
for RootNode<'a, QueryT, MutationT, S>
|
for RootNode<'a, QueryT, MutationT, S>
|
||||||
where
|
where
|
||||||
|
@ -93,7 +92,7 @@ where
|
||||||
arguments: &'b Arguments<S>,
|
arguments: &'b Arguments<S>,
|
||||||
executor: &'b Executor<Self::Context, S>,
|
executor: &'b Executor<Self::Context, S>,
|
||||||
) -> crate::BoxFuture<'b, ExecutionResult<S>> {
|
) -> crate::BoxFuture<'b, ExecutionResult<S>> {
|
||||||
use futures::future::{ready, FutureExt};
|
use futures::future::ready;
|
||||||
match field_name {
|
match field_name {
|
||||||
"__schema" | "__type" => {
|
"__schema" | "__type" => {
|
||||||
let v = self.resolve_field(info, field_name, arguments, executor);
|
let v = self.resolve_field(info, field_name, arguments, executor);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::{Directive, FromInputValue, InputValue, Selection},
|
ast::Selection,
|
||||||
value::{Object, ScalarValue, Value},
|
value::{Object, ScalarValue, Value},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ use crate::BoxFuture;
|
||||||
|
|
||||||
use super::base::{is_excluded, merge_key_into, Arguments, GraphQLType};
|
use super::base::{is_excluded, merge_key_into, Arguments, GraphQLType};
|
||||||
|
|
||||||
|
// TODO: docs.
|
||||||
pub trait GraphQLTypeAsync<S>: GraphQLType<S> + Send + Sync
|
pub trait GraphQLTypeAsync<S>: GraphQLType<S> + Send + Sync
|
||||||
where
|
where
|
||||||
Self::Context: Send + Sync,
|
Self::Context: Send + Sync,
|
||||||
|
@ -62,7 +63,6 @@ where
|
||||||
|
|
||||||
// Wrapper function around resolve_selection_set_into_async_recursive.
|
// Wrapper function around resolve_selection_set_into_async_recursive.
|
||||||
// This wrapper is necessary because async fns can not be recursive.
|
// This wrapper is necessary because async fns can not be recursive.
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub(crate) fn resolve_selection_set_into_async<'a, 'e, T, CtxT, S>(
|
pub(crate) fn resolve_selection_set_into_async<'a, 'e, T, CtxT, S>(
|
||||||
instance: &'a T,
|
instance: &'a T,
|
||||||
info: &'a T::TypeInfo,
|
info: &'a T::TypeInfo,
|
||||||
|
@ -94,7 +94,6 @@ enum AsyncValue<S> {
|
||||||
Nested(Value<S>),
|
Nested(Value<S>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub(crate) async fn resolve_selection_set_into_async_recursive<'a, T, CtxT, S>(
|
pub(crate) async fn resolve_selection_set_into_async_recursive<'a, T, CtxT, S>(
|
||||||
instance: &'a T,
|
instance: &'a T,
|
||||||
info: &'a T::TypeInfo,
|
info: &'a T::TypeInfo,
|
||||||
|
|
|
@ -210,7 +210,6 @@ where
|
||||||
Ok(Value::list(result))
|
Ok(Value::list(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
async fn resolve_into_list_async<'a, S, T, I>(
|
async fn resolve_into_list_async<'a, S, T, I>(
|
||||||
executor: &'a Executor<'a, T::Context, S>,
|
executor: &'a Executor<'a, T::Context, S>,
|
||||||
info: &'a T::TypeInfo,
|
info: &'a T::TypeInfo,
|
||||||
|
@ -247,7 +246,6 @@ where
|
||||||
Ok(Value::list(values))
|
Ok(Value::list(values))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
impl<S, T, CtxT> crate::GraphQLTypeAsync<S> for Vec<T>
|
impl<S, T, CtxT> crate::GraphQLTypeAsync<S> for Vec<T>
|
||||||
where
|
where
|
||||||
T: crate::GraphQLTypeAsync<S, Context = CtxT>,
|
T: crate::GraphQLTypeAsync<S, Context = CtxT>,
|
||||||
|
@ -266,7 +264,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
impl<S, T, CtxT> crate::GraphQLTypeAsync<S> for &[T]
|
impl<S, T, CtxT> crate::GraphQLTypeAsync<S> for &[T]
|
||||||
where
|
where
|
||||||
T: crate::GraphQLTypeAsync<S, Context = CtxT>,
|
T: crate::GraphQLTypeAsync<S, Context = CtxT>,
|
||||||
|
@ -285,7 +282,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
impl<S, T, CtxT> crate::GraphQLTypeAsync<S> for Option<T>
|
impl<S, T, CtxT> crate::GraphQLTypeAsync<S> for Option<T>
|
||||||
where
|
where
|
||||||
T: crate::GraphQLTypeAsync<S, Context = CtxT>,
|
T: crate::GraphQLTypeAsync<S, Context = CtxT>,
|
||||||
|
|
|
@ -5,5 +5,4 @@ pub mod pointers;
|
||||||
pub mod scalars;
|
pub mod scalars;
|
||||||
pub mod utilities;
|
pub mod utilities;
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub mod async_await;
|
pub mod async_await;
|
||||||
|
|
|
@ -129,7 +129,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
impl<'e, S, T> crate::GraphQLTypeAsync<S> for &'e T
|
impl<'e, S, T> crate::GraphQLTypeAsync<S> for &'e T
|
||||||
where
|
where
|
||||||
S: ScalarValue + Send + Sync,
|
S: ScalarValue + Send + Sync,
|
||||||
|
@ -216,7 +215,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
impl<'e, S, T> crate::GraphQLTypeAsync<S> for std::sync::Arc<T>
|
impl<'e, S, T> crate::GraphQLTypeAsync<S> for std::sync::Arc<T>
|
||||||
where
|
where
|
||||||
S: ScalarValue + Send + Sync,
|
S: ScalarValue + Send + Sync,
|
||||||
|
@ -230,7 +228,6 @@ where
|
||||||
selection_set: Option<&'a [Selection<S>]>,
|
selection_set: Option<&'a [Selection<S>]>,
|
||||||
executor: &'a Executor<Self::Context, S>,
|
executor: &'a Executor<Self::Context, S>,
|
||||||
) -> crate::BoxFuture<'a, crate::ExecutionResult<S>> {
|
) -> crate::BoxFuture<'a, crate::ExecutionResult<S>> {
|
||||||
use futures::future;
|
|
||||||
(**self).resolve_async(info, selection_set, executor)
|
(**self).resolve_async(info, selection_set, executor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use futures;
|
use futures;
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use std::{char, convert::From, marker::PhantomData, ops::Deref, u32};
|
use std::{char, convert::From, marker::PhantomData, ops::Deref, u32};
|
||||||
|
@ -196,7 +195,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
impl<'e, S> crate::GraphQLTypeAsync<S> for &'e str
|
impl<'e, S> crate::GraphQLTypeAsync<S> for &'e str
|
||||||
where
|
where
|
||||||
S: ScalarValue + Send + Sync,
|
S: ScalarValue + Send + Sync,
|
||||||
|
@ -329,7 +327,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
impl<S, T> crate::GraphQLTypeAsync<S> for EmptyMutation<T>
|
impl<S, T> crate::GraphQLTypeAsync<S> for EmptyMutation<T>
|
||||||
where
|
where
|
||||||
S: ScalarValue + Send + Sync,
|
S: ScalarValue + Send + Sync,
|
||||||
|
|
|
@ -9,11 +9,8 @@ edition = "2018"
|
||||||
name = "benchmark"
|
name = "benchmark"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
[features]
|
|
||||||
async = []
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
juniper = { path = "../juniper", features = ["async"] }
|
juniper = { path = "../juniper" }
|
||||||
futures = "0.3.1"
|
futures = "0.3.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -14,18 +14,15 @@ edition = "2018"
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
[features]
|
|
||||||
async = ["futures"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
proc-macro2 = "1.0.1"
|
proc-macro2 = "1.0.1"
|
||||||
syn = { version = "1.0.3", features = ["full", "extra-traits", "parsing"] }
|
syn = { version = "1.0.3", features = ["full", "extra-traits", "parsing"] }
|
||||||
quote = "1.0.2"
|
quote = "1.0.3"
|
||||||
proc-macro-error = "0.3.4"
|
proc-macro-error = "0.3.4"
|
||||||
futures = { version = "0.3.1", optional = true }
|
futures = "0.3.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
juniper = { version = "0.14.2", path = "../juniper", features = ["async"] }
|
juniper = { version = "0.14.2", path = "../juniper"}
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
travis-ci = { repository = "graphql-rust/juniper" }
|
travis-ci = { repository = "graphql-rust/juniper" }
|
||||||
|
|
|
@ -206,7 +206,6 @@ pub fn impl_enum(ast: &syn::DeriveInput, is_internal: bool) -> TokenStream {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
let _async = quote!(
|
let _async = quote!(
|
||||||
impl<__S> #juniper_path::GraphQLTypeAsync<__S> for #ident
|
impl<__S> #juniper_path::GraphQLTypeAsync<__S> for #ident
|
||||||
where
|
where
|
||||||
|
@ -226,9 +225,6 @@ pub fn impl_enum(ast: &syn::DeriveInput, is_internal: bool) -> TokenStream {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(not(feature = "async"))]
|
|
||||||
let _async = quote!();
|
|
||||||
|
|
||||||
let body = quote! {
|
let body = quote! {
|
||||||
impl<__S> #juniper_path::GraphQLType<__S> for #ident
|
impl<__S> #juniper_path::GraphQLType<__S> for #ident
|
||||||
where __S:
|
where __S:
|
||||||
|
|
|
@ -110,7 +110,6 @@ fn impl_scalar_struct(
|
||||||
None => quote!(),
|
None => quote!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
let _async = quote!(
|
let _async = quote!(
|
||||||
|
|
||||||
impl <__S> #crate_name::GraphQLTypeAsync<__S> for #ident
|
impl <__S> #crate_name::GraphQLTypeAsync<__S> for #ident
|
||||||
|
@ -134,9 +133,6 @@ fn impl_scalar_struct(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(not(feature = "async"))]
|
|
||||||
let _async = quote!();
|
|
||||||
|
|
||||||
quote!(
|
quote!(
|
||||||
#_async
|
#_async
|
||||||
|
|
||||||
|
|
|
@ -830,7 +830,6 @@ impl GraphQLTypeDefiniton {
|
||||||
};
|
};
|
||||||
let (impl_generics, _, where_clause) = generics.split_for_impl();
|
let (impl_generics, _, where_clause) = generics.split_for_impl();
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
let resolve_field_async = {
|
let resolve_field_async = {
|
||||||
let resolve_matches_async = self.fields.iter().map(|field| {
|
let resolve_matches_async = self.fields.iter().map(|field| {
|
||||||
let name = &field.name;
|
let name = &field.name;
|
||||||
|
@ -946,9 +945,6 @@ impl GraphQLTypeDefiniton {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(feature = "async"))]
|
|
||||||
let resolve_field_async = quote!();
|
|
||||||
|
|
||||||
let output = quote!(
|
let output = quote!(
|
||||||
impl#impl_generics #juniper_crate_name::GraphQLType<#scalar> for #ty #type_generics_tokens
|
impl#impl_generics #juniper_crate_name::GraphQLType<#scalar> for #ty #type_generics_tokens
|
||||||
#where_clause
|
#where_clause
|
||||||
|
@ -1011,7 +1007,7 @@ impl GraphQLTypeDefiniton {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use quote::__rt::*;
|
use quote::__private::*;
|
||||||
use syn::{Ident, LitStr};
|
use syn::{Ident, LitStr};
|
||||||
|
|
||||||
fn strs_to_strings(source: Vec<&str>) -> Vec<String> {
|
fn strs_to_strings(source: Vec<&str>) -> Vec<String> {
|
||||||
|
|
|
@ -8,9 +8,6 @@ documentation = "https://docs.rs/juniper_hyper"
|
||||||
repository = "https://github.com/graphql-rust/juniper"
|
repository = "https://github.com/graphql-rust/juniper"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[features]
|
|
||||||
async = ["juniper/async", "futures"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
@ -19,7 +16,7 @@ url = "2"
|
||||||
juniper = { version = "0.14.2", default-features = false, path = "../juniper"}
|
juniper = { version = "0.14.2", default-features = false, path = "../juniper"}
|
||||||
tokio = "0.2"
|
tokio = "0.2"
|
||||||
hyper = "0.13"
|
hyper = "0.13"
|
||||||
futures = { version = "0.3", optional = true }
|
futures = { version = "0.3.1" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pretty_env_logger = "0.2"
|
pretty_env_logger = "0.2"
|
||||||
|
|
|
@ -8,8 +8,5 @@ condition = { channels = ["nightly"] }
|
||||||
[tasks.test-verbose]
|
[tasks.test-verbose]
|
||||||
condition = { channels = ["nightly"] }
|
condition = { channels = ["nightly"] }
|
||||||
|
|
||||||
[tasks.test-async-verbose]
|
|
||||||
condition = { channels = ["nightly"] }
|
|
||||||
|
|
||||||
[tasks.ci-coverage-flow]
|
[tasks.ci-coverage-flow]
|
||||||
condition = { channels = ["nightly"] }
|
condition = { channels = ["nightly"] }
|
||||||
|
|
|
@ -3,17 +3,14 @@
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate reqwest;
|
extern crate reqwest;
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use futures;
|
use futures;
|
||||||
use hyper::{
|
use hyper::{
|
||||||
header::{self, HeaderValue},
|
header::{self, HeaderValue},
|
||||||
Body, Method, Request, Response, StatusCode,
|
Body, Method, Request, Response, StatusCode,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use juniper::GraphQLTypeAsync;
|
|
||||||
use juniper::{
|
use juniper::{
|
||||||
http::GraphQLRequest as JuniperGraphQLRequest, serde::Deserialize, DefaultScalarValue,
|
http::GraphQLRequest as JuniperGraphQLRequest, serde::Deserialize, DefaultScalarValue,
|
||||||
GraphQLType, InputValue, RootNode, ScalarValue,
|
GraphQLType, GraphQLTypeAsync, InputValue, RootNode, ScalarValue,
|
||||||
};
|
};
|
||||||
use serde_json::error::Error as SerdeError;
|
use serde_json::error::Error as SerdeError;
|
||||||
use std::{error::Error, fmt, string::FromUtf8Error, sync::Arc};
|
use std::{error::Error, fmt, string::FromUtf8Error, sync::Arc};
|
||||||
|
@ -53,7 +50,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub async fn graphql_async<CtxT, QueryT, MutationT, S>(
|
pub async fn graphql_async<CtxT, QueryT, MutationT, S>(
|
||||||
root_node: Arc<RootNode<'static, QueryT, MutationT, S>>,
|
root_node: Arc<RootNode<'static, QueryT, MutationT, S>>,
|
||||||
context: Arc<CtxT>,
|
context: Arc<CtxT>,
|
||||||
|
@ -164,7 +160,6 @@ where
|
||||||
resp
|
resp
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
async fn execute_request_async<CtxT, QueryT, MutationT, S>(
|
async fn execute_request_async<CtxT, QueryT, MutationT, S>(
|
||||||
root_node: Arc<RootNode<'static, QueryT, MutationT, S>>,
|
root_node: Arc<RootNode<'static, QueryT, MutationT, S>>,
|
||||||
context: Arc<CtxT>,
|
context: Arc<CtxT>,
|
||||||
|
@ -309,7 +304,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
async fn execute_async<'a, CtxT: 'a, QueryT, MutationT>(
|
async fn execute_async<'a, CtxT: 'a, QueryT, MutationT>(
|
||||||
self,
|
self,
|
||||||
root_node: Arc<RootNode<'a, QueryT, MutationT, S>>,
|
root_node: Arc<RootNode<'a, QueryT, MutationT, S>>,
|
||||||
|
@ -391,7 +385,7 @@ impl Error for GraphQLRequestError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "async")]
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use futures;
|
use futures;
|
||||||
|
|
|
@ -11,15 +11,12 @@ documentation = "https://docs.rs/juniper_iron"
|
||||||
repository = "https://github.com/graphql-rust/juniper"
|
repository = "https://github.com/graphql-rust/juniper"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[features]
|
|
||||||
# Fake feature to help CI.
|
|
||||||
async = []
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { version = "1.0.2" }
|
serde = { version = "1.0.2" }
|
||||||
serde_json = { version = "1.0.2" }
|
serde_json = { version = "1.0.2" }
|
||||||
serde_derive = { version = "1.0.2" }
|
serde_derive = { version = "1.0.2" }
|
||||||
juniper = { version = "0.14.2", path = "../juniper" }
|
juniper = { version = "0.14.2", path = "../juniper" }
|
||||||
|
futures = "0.3.1"
|
||||||
|
|
||||||
urlencoded = { version = ">= 0.5, < 0.7" }
|
urlencoded = { version = ">= 0.5, < 0.7" }
|
||||||
iron = ">= 0.5, < 0.7"
|
iron = ">= 0.5, < 0.7"
|
||||||
|
|
|
@ -11,10 +11,6 @@ documentation = "https://docs.rs/juniper_rocket"
|
||||||
repository = "https://github.com/graphql-rust/juniper"
|
repository = "https://github.com/graphql-rust/juniper"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[features]
|
|
||||||
# Fake feature to help CI.
|
|
||||||
async = []
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { version = "1.0.2" }
|
serde = { version = "1.0.2" }
|
||||||
serde_json = { version = "1.0.2" }
|
serde_json = { version = "1.0.2" }
|
||||||
|
|
|
@ -7,9 +7,6 @@ condition = { channels = ["nightly"], env = { "TARGET" = "x86_64-pc-windows-msvc
|
||||||
[tasks.test-verbose]
|
[tasks.test-verbose]
|
||||||
condition = { channels = ["nightly"] }
|
condition = { channels = ["nightly"] }
|
||||||
|
|
||||||
[tasks.test-async-verbose]
|
|
||||||
condition = { channels = ["nightly"] }
|
|
||||||
|
|
||||||
[tasks.test-verbose.windows]
|
[tasks.test-verbose.windows]
|
||||||
condition = { channels = ["nightly"], env = { "TARGET" = "x86_64-pc-windows-msvc" } }
|
condition = { channels = ["nightly"], env = { "TARGET" = "x86_64-pc-windows-msvc" } }
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,6 @@ documentation = "https://docs.rs/juniper_rocket"
|
||||||
repository = "https://github.com/graphql-rust/juniper"
|
repository = "https://github.com/graphql-rust/juniper"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[features]
|
|
||||||
async = [ "juniper/async" ]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { version = "1.0.2" }
|
serde = { version = "1.0.2" }
|
||||||
serde_json = { version = "1.0.2" }
|
serde_json = { version = "1.0.2" }
|
||||||
|
|
|
@ -7,9 +7,6 @@ condition = { channels = ["nightly"], env = { "TARGET" = "x86_64-pc-windows-msvc
|
||||||
[tasks.test-verbose]
|
[tasks.test-verbose]
|
||||||
condition = { channels = ["nightly"] }
|
condition = { channels = ["nightly"] }
|
||||||
|
|
||||||
[tasks.test-async-verbose]
|
|
||||||
condition = { channels = ["nightly"] }
|
|
||||||
|
|
||||||
[tasks.test-verbose.windows]
|
[tasks.test-verbose.windows]
|
||||||
condition = { channels = ["nightly"], env = { "TARGET" = "x86_64-pc-windows-msvc" } }
|
condition = { channels = ["nightly"], env = { "TARGET" = "x86_64-pc-windows-msvc" } }
|
||||||
|
|
||||||
|
|
|
@ -52,15 +52,10 @@ use rocket::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use juniper::{http, InputValue};
|
use juniper::{http, InputValue};
|
||||||
|
|
||||||
use juniper::{
|
use juniper::{
|
||||||
serde::Deserialize, DefaultScalarValue, FieldError, GraphQLType, RootNode, ScalarValue,
|
serde::Deserialize, DefaultScalarValue, FieldError, GraphQLType, RootNode, ScalarValue,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use juniper::GraphQLTypeAsync;
|
use juniper::GraphQLTypeAsync;
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use futures::future::{FutureExt, TryFutureExt};
|
use futures::future::{FutureExt, TryFutureExt};
|
||||||
|
|
||||||
#[derive(Debug, serde_derive::Deserialize, PartialEq)]
|
#[derive(Debug, serde_derive::Deserialize, PartialEq)]
|
||||||
|
@ -110,7 +105,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub async fn execute_async<'a, CtxT, QueryT, MutationT>(
|
pub async fn execute_async<'a, CtxT, QueryT, MutationT>(
|
||||||
&'a self,
|
&'a self,
|
||||||
root_node: &'a RootNode<'_, QueryT, MutationT, S>,
|
root_node: &'a RootNode<'_, QueryT, MutationT, S>,
|
||||||
|
@ -213,7 +207,6 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Asynchronously execute an incoming GraphQL query
|
/// Asynchronously execute an incoming GraphQL query
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub async fn execute_async<CtxT, QueryT, MutationT>(
|
pub async fn execute_async<CtxT, QueryT, MutationT>(
|
||||||
&self,
|
&self,
|
||||||
root_node: &RootNode<'_, QueryT, MutationT, S>,
|
root_node: &RootNode<'_, QueryT, MutationT, S>,
|
||||||
|
|
|
@ -8,9 +8,6 @@ documentation = "https://docs.rs/juniper_warp"
|
||||||
repository = "https://github.com/graphql-rust/juniper"
|
repository = "https://github.com/graphql-rust/juniper"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[features]
|
|
||||||
async = [ "juniper/async", "futures03" ]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
warp = "0.1.8"
|
warp = "0.1.8"
|
||||||
juniper = { version = "0.14.2", path = "../juniper", default-features = false }
|
juniper = { version = "0.14.2", path = "../juniper", default-features = false }
|
||||||
|
|
|
@ -45,7 +45,6 @@ use serde::Deserialize;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use warp::{filters::BoxedFilter, Filter};
|
use warp::{filters::BoxedFilter, Filter};
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
use futures03::future::{FutureExt, TryFutureExt};
|
use futures03::future::{FutureExt, TryFutureExt};
|
||||||
|
|
||||||
use juniper::{DefaultScalarValue, InputValue, ScalarValue};
|
use juniper::{DefaultScalarValue, InputValue, ScalarValue};
|
||||||
|
@ -87,7 +86,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub async fn execute_async<'a, CtxT, QueryT, MutationT>(
|
pub async fn execute_async<'a, CtxT, QueryT, MutationT>(
|
||||||
&'a self,
|
&'a self,
|
||||||
root_node: &'a juniper::RootNode<'a, QueryT, MutationT, S>,
|
root_node: &'a juniper::RootNode<'a, QueryT, MutationT, S>,
|
||||||
|
@ -272,7 +270,6 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// FIXME: docs
|
/// FIXME: docs
|
||||||
#[cfg(feature = "async")]
|
|
||||||
pub fn make_graphql_filter_async<Query, Mutation, Context, S>(
|
pub fn make_graphql_filter_async<Query, Mutation, Context, S>(
|
||||||
schema: juniper::RootNode<'static, Query, Mutation, S>,
|
schema: juniper::RootNode<'static, Query, Mutation, S>,
|
||||||
context_extractor: BoxedFilter<(Context,)>,
|
context_extractor: BoxedFilter<(Context,)>,
|
||||||
|
|
Loading…
Reference in a new issue