Formatting...
This commit is contained in:
parent
3cc142bfbc
commit
de12e0eba5
6 changed files with 40 additions and 48 deletions
|
@ -109,21 +109,14 @@ extern crate uuid;
|
|||
// This allows users to just depend on juniper and get the derive
|
||||
// functionality automatically.
|
||||
pub use juniper_codegen::{
|
||||
GraphQLEnum,
|
||||
GraphQLInputObject,
|
||||
GraphQLObject,
|
||||
GraphQLScalarValue,
|
||||
ScalarValue,
|
||||
impl_object,
|
||||
impl_object, GraphQLEnum, GraphQLInputObject, GraphQLObject, GraphQLScalarValue, ScalarValue,
|
||||
};
|
||||
// Internal macros are not exported,
|
||||
// but declared at the root to make them easier to use.
|
||||
#[allow(unused_imports)]
|
||||
use juniper_codegen::{
|
||||
impl_object_internal, GraphQLEnumInternal, GraphQLInputObjectInternal,
|
||||
GraphQLScalarValueInternal,
|
||||
GraphQLEnumInternal,
|
||||
GraphQLInputObjectInternal,
|
||||
impl_object_internal,
|
||||
};
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -146,15 +146,13 @@ where
|
|||
fn fields(&self, include_deprecated: bool) -> Option<Vec<&Field<S>>> {
|
||||
match *self {
|
||||
TypeType::Concrete(&MetaType::Interface(InterfaceMeta { ref fields, .. }))
|
||||
| TypeType::Concrete(&MetaType::Object(ObjectMeta { ref fields, .. })) => {
|
||||
Some(
|
||||
fields
|
||||
.iter()
|
||||
.filter(|f| include_deprecated || !f.deprecation_status.is_deprecated())
|
||||
.filter(|f| !f.name.starts_with("__"))
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
| TypeType::Concrete(&MetaType::Object(ObjectMeta { ref fields, .. })) => Some(
|
||||
fields
|
||||
.iter()
|
||||
.filter(|f| include_deprecated || !f.deprecation_status.is_deprecated())
|
||||
.filter(|f| !f.name.starts_with("__"))
|
||||
.collect(),
|
||||
),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
@ -233,14 +231,12 @@ where
|
|||
#[graphql(arguments(include_deprecated(default = false)))]
|
||||
fn enum_values(&self, include_deprecated: bool) -> Option<Vec<&EnumValue>> {
|
||||
match *self {
|
||||
TypeType::Concrete(&MetaType::Enum(EnumMeta { ref values, .. })) => {
|
||||
Some(
|
||||
values
|
||||
.iter()
|
||||
.filter(|f| include_deprecated || !f.deprecation_status.is_deprecated())
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
TypeType::Concrete(&MetaType::Enum(EnumMeta { ref values, .. })) => Some(
|
||||
values
|
||||
.iter()
|
||||
.filter(|f| include_deprecated || !f.deprecation_status.is_deprecated())
|
||||
.collect(),
|
||||
),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,13 +163,16 @@ pub fn build_impl_object(args: TokenStream, body: TokenStream, is_internal: bool
|
|||
}
|
||||
// Make sure the user does not specify the Context
|
||||
// without a reference. (&Context)
|
||||
else if context_type.clone().map(|ctx| ctx == &captured.ty).unwrap_or(false) {
|
||||
else if context_type
|
||||
.clone()
|
||||
.map(|ctx| ctx == &captured.ty)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
panic!(
|
||||
"Invalid context argument: to access the context, you need to specify the type as a reference.\nDid you mean &{}?",
|
||||
quote!(captured.ty),
|
||||
);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
let ty = &captured.ty;
|
||||
// TODO: respect graphql attribute overwrite.
|
||||
let final_name = util::to_camel_case(&arg_name);
|
||||
|
|
|
@ -764,9 +764,9 @@ impl GraphQLTypeDefiniton {
|
|||
// Insert a where clause that marks the scalar as
|
||||
// compatible with ScalarValueRef.
|
||||
// Same as in branch above.
|
||||
where_clause.predicates.push(
|
||||
parse_quote!(for<'__b> &'__b __S: #juniper_crate_name::ScalarRefValue<'__b>),
|
||||
);
|
||||
where_clause
|
||||
.predicates
|
||||
.push(parse_quote!(for<'__b> &'__b __S: #juniper_crate_name::ScalarRefValue<'__b>));
|
||||
}
|
||||
|
||||
let type_generics_tokens = if self.include_type_generics {
|
||||
|
|
Loading…
Reference in a new issue