Enable merge_imports rustfmt setting.
style: Enable rustfmt merge_imports and format This commit enables the rustfmt merge_imports setting and formats the whole code base accordingly. Note that the setting is not stable yet, but will be with Rust 1.38. In the meantime, running fmt on stable will just leave the changes alone so no problems should occur.
This commit is contained in:
parent
a3caf126b0
commit
835dee1a8e
91 changed files with 850 additions and 675 deletions
|
@ -1,8 +1,9 @@
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
|
|
||||||
use juniper::DefaultScalarValue;
|
use juniper::{
|
||||||
use juniper::GraphQLInputObject;
|
self, DefaultScalarValue, FromInputValue, GraphQLInputObject, GraphQLType, InputValue,
|
||||||
use juniper::{self, FromInputValue, GraphQLType, InputValue, ToInputValue};
|
ToInputValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(GraphQLInputObject, Debug, PartialEq)]
|
#[derive(GraphQLInputObject, Debug, PartialEq)]
|
||||||
#[graphql(
|
#[graphql(
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
use juniper::DefaultScalarValue;
|
|
||||||
use juniper::GraphQLObject;
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use juniper::Object;
|
use juniper::Object;
|
||||||
|
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};
|
||||||
|
|
|
@ -2,11 +2,13 @@ extern crate serde_json;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use juniper::parser::Spanning;
|
use juniper::parser::Spanning;
|
||||||
use juniper::parser::{ParseError, ScalarToken, Token};
|
|
||||||
use juniper::serde::de;
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use juniper::{execute, EmptyMutation, Object, RootNode, Variables};
|
use juniper::{execute, EmptyMutation, Object, RootNode, Variables};
|
||||||
use juniper::{InputValue, ParseScalarResult, ScalarValue, Value};
|
use juniper::{
|
||||||
|
parser::{ParseError, ScalarToken, Token},
|
||||||
|
serde::de,
|
||||||
|
InputValue, ParseScalarResult, ScalarValue, Value,
|
||||||
|
};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, juniper::GraphQLScalarValue)]
|
#[derive(Debug, Clone, PartialEq, juniper::GraphQLScalarValue)]
|
||||||
|
|
|
@ -4,8 +4,7 @@ extern crate juniper;
|
||||||
|
|
||||||
use bencher::Bencher;
|
use bencher::Bencher;
|
||||||
|
|
||||||
use juniper::tests::model::Database;
|
use juniper::{execute, tests::model::Database, EmptyMutation, RootNode, Variables};
|
||||||
use juniper::{execute, EmptyMutation, RootNode, Variables};
|
|
||||||
|
|
||||||
fn query_type_name(b: &mut Bencher) {
|
fn query_type_name(b: &mut Bencher) {
|
||||||
let database = Database::new();
|
let database = Database::new();
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
use std::borrow::Cow;
|
use std::{borrow::Cow, fmt, hash::Hash, slice, vec};
|
||||||
use std::fmt;
|
|
||||||
use std::hash::Hash;
|
|
||||||
use std::slice;
|
|
||||||
use std::vec;
|
|
||||||
|
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
|
|
||||||
use crate::executor::Variables;
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
executor::Variables,
|
||||||
use crate::value::{DefaultScalarValue, ScalarRefValue, ScalarValue};
|
parser::Spanning,
|
||||||
|
value::{DefaultScalarValue, ScalarRefValue, ScalarValue},
|
||||||
|
};
|
||||||
|
|
||||||
/// A type literal in the syntax tree
|
/// A type literal in the syntax tree
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use crate::ast::{Directive, Fragment, InputValue, Selection};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::{Directive, Fragment, InputValue, Selection},
|
||||||
use crate::value::{ScalarRefValue, ScalarValue};
|
parser::Spanning,
|
||||||
|
value::{ScalarRefValue, ScalarValue},
|
||||||
|
};
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
@ -388,11 +390,13 @@ impl<'a, S> LookAheadMethods<S> for LookAheadSelection<'a, S> {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::ast::Document;
|
use crate::{
|
||||||
use crate::parser::UnlocatedParseResult;
|
ast::Document,
|
||||||
use crate::schema::model::SchemaType;
|
parser::UnlocatedParseResult,
|
||||||
use crate::validation::test_harness::{MutationRoot, QueryRoot};
|
schema::model::SchemaType,
|
||||||
use crate::value::{DefaultScalarValue, ScalarRefValue, ScalarValue};
|
validation::test_harness::{MutationRoot, QueryRoot},
|
||||||
|
value::{DefaultScalarValue, ScalarRefValue, ScalarValue},
|
||||||
|
};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
fn parse_document_source<S>(q: &str) -> UnlocatedParseResult<Document<S>>
|
fn parse_document_source<S>(q: &str) -> UnlocatedParseResult<Document<S>>
|
||||||
|
@ -1395,5 +1399,4 @@ fragment heroFriendNames on Hero {
|
||||||
panic!("No Operation found");
|
panic!("No Operation found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,29 @@
|
||||||
use std::borrow::Cow;
|
use std::{borrow::Cow, cmp::Ordering, collections::HashMap, fmt::Display, sync::RwLock};
|
||||||
use std::cmp::Ordering;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::fmt::Display;
|
|
||||||
use std::sync::RwLock;
|
|
||||||
|
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
|
|
||||||
use crate::ast::{
|
use crate::{
|
||||||
Definition, Document, Fragment, FromInputValue, InputValue, OperationType, Selection,
|
ast::{
|
||||||
ToInputValue, Type,
|
Definition, Document, Fragment, FromInputValue, InputValue, OperationType, Selection,
|
||||||
|
ToInputValue, Type,
|
||||||
|
},
|
||||||
|
parser::SourcePosition,
|
||||||
|
value::Value,
|
||||||
|
GraphQLError,
|
||||||
};
|
};
|
||||||
use crate::parser::SourcePosition;
|
|
||||||
use crate::value::Value;
|
|
||||||
use crate::GraphQLError;
|
|
||||||
|
|
||||||
use crate::schema::meta::{
|
use crate::schema::{
|
||||||
Argument, DeprecationStatus, EnumMeta, EnumValue, Field, InputObjectMeta, InterfaceMeta,
|
meta::{
|
||||||
ListMeta, MetaType, NullableMeta, ObjectMeta, PlaceholderMeta, ScalarMeta, UnionMeta,
|
Argument, DeprecationStatus, EnumMeta, EnumValue, Field, InputObjectMeta, InterfaceMeta,
|
||||||
|
ListMeta, MetaType, NullableMeta, ObjectMeta, PlaceholderMeta, ScalarMeta, UnionMeta,
|
||||||
|
},
|
||||||
|
model::{RootNode, SchemaType, TypeType},
|
||||||
};
|
};
|
||||||
use crate::schema::model::{RootNode, SchemaType, TypeType};
|
|
||||||
|
|
||||||
use crate::types::base::GraphQLType;
|
use crate::{
|
||||||
use crate::types::name::Name;
|
types::{base::GraphQLType, name::Name},
|
||||||
use crate::value::{DefaultScalarValue, ParseScalarValue, ScalarRefValue, ScalarValue};
|
value::{DefaultScalarValue, ParseScalarValue, ScalarRefValue, ScalarValue},
|
||||||
|
};
|
||||||
|
|
||||||
mod look_ahead;
|
mod look_ahead;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::executor::Variables;
|
use crate::{
|
||||||
use crate::schema::model::RootNode;
|
executor::Variables,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::value::{DefaultScalarValue, Object, Value};
|
types::scalars::EmptyMutation,
|
||||||
|
value::{DefaultScalarValue, Object, Value},
|
||||||
|
};
|
||||||
|
|
||||||
struct TestType;
|
struct TestType;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
use juniper_codegen::GraphQLEnumInternal as GraphQLEnum;
|
use juniper_codegen::GraphQLEnumInternal as GraphQLEnum;
|
||||||
|
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::executor::Variables;
|
ast::InputValue,
|
||||||
use crate::parser::SourcePosition;
|
executor::Variables,
|
||||||
use crate::schema::model::RootNode;
|
parser::SourcePosition,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::validation::RuleError;
|
types::scalars::EmptyMutation,
|
||||||
use crate::value::{DefaultScalarValue, Object, Value};
|
validation::RuleError,
|
||||||
use crate::GraphQLError::ValidationError;
|
value::{DefaultScalarValue, Object, Value},
|
||||||
|
GraphQLError::ValidationError,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(GraphQLEnum, Debug)]
|
#[derive(GraphQLEnum, Debug)]
|
||||||
enum Color {
|
enum Color {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
mod field_execution {
|
mod field_execution {
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::schema::model::RootNode;
|
ast::InputValue, schema::model::RootNode, types::scalars::EmptyMutation, value::Value,
|
||||||
use crate::types::scalars::EmptyMutation;
|
};
|
||||||
use crate::value::Value;
|
|
||||||
|
|
||||||
struct DataType;
|
struct DataType;
|
||||||
struct DeepDataType;
|
struct DeepDataType;
|
||||||
|
@ -156,9 +155,7 @@ mod field_execution {
|
||||||
}
|
}
|
||||||
|
|
||||||
mod merge_parallel_fragments {
|
mod merge_parallel_fragments {
|
||||||
use crate::schema::model::RootNode;
|
use crate::{schema::model::RootNode, types::scalars::EmptyMutation, value::Value};
|
||||||
use crate::types::scalars::EmptyMutation;
|
|
||||||
use crate::value::Value;
|
|
||||||
|
|
||||||
struct Type;
|
struct Type;
|
||||||
|
|
||||||
|
@ -239,9 +236,7 @@ mod merge_parallel_fragments {
|
||||||
}
|
}
|
||||||
|
|
||||||
mod merge_parallel_inline_fragments {
|
mod merge_parallel_inline_fragments {
|
||||||
use crate::schema::model::RootNode;
|
use crate::{schema::model::RootNode, types::scalars::EmptyMutation, value::Value};
|
||||||
use crate::types::scalars::EmptyMutation;
|
|
||||||
use crate::value::Value;
|
|
||||||
|
|
||||||
struct Type;
|
struct Type;
|
||||||
struct Other;
|
struct Other;
|
||||||
|
@ -383,10 +378,9 @@ mod merge_parallel_inline_fragments {
|
||||||
}
|
}
|
||||||
|
|
||||||
mod threads_context_correctly {
|
mod threads_context_correctly {
|
||||||
use crate::executor::Context;
|
use crate::{
|
||||||
use crate::schema::model::RootNode;
|
executor::Context, schema::model::RootNode, types::scalars::EmptyMutation, value::Value,
|
||||||
use crate::types::scalars::EmptyMutation;
|
};
|
||||||
use crate::value::Value;
|
|
||||||
|
|
||||||
struct Schema;
|
struct Schema;
|
||||||
|
|
||||||
|
@ -441,11 +435,13 @@ mod threads_context_correctly {
|
||||||
mod dynamic_context_switching {
|
mod dynamic_context_switching {
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
|
|
||||||
use crate::executor::{Context, ExecutionError, FieldError, FieldResult};
|
use crate::{
|
||||||
use crate::parser::SourcePosition;
|
executor::{Context, ExecutionError, FieldError, FieldResult},
|
||||||
use crate::schema::model::RootNode;
|
parser::SourcePosition,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::value::Value;
|
types::scalars::EmptyMutation,
|
||||||
|
value::Value,
|
||||||
|
};
|
||||||
|
|
||||||
struct Schema;
|
struct Schema;
|
||||||
|
|
||||||
|
@ -772,11 +768,13 @@ mod dynamic_context_switching {
|
||||||
}
|
}
|
||||||
|
|
||||||
mod propagates_errors_to_nullable_fields {
|
mod propagates_errors_to_nullable_fields {
|
||||||
use crate::executor::{ExecutionError, FieldError, FieldResult, IntoFieldError};
|
use crate::{
|
||||||
use crate::parser::SourcePosition;
|
executor::{ExecutionError, FieldError, FieldResult, IntoFieldError},
|
||||||
use crate::schema::model::RootNode;
|
parser::SourcePosition,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::value::{ScalarValue, Value};
|
types::scalars::EmptyMutation,
|
||||||
|
value::{ScalarValue, Value},
|
||||||
|
};
|
||||||
|
|
||||||
struct Schema;
|
struct Schema;
|
||||||
struct Inner;
|
struct Inner;
|
||||||
|
@ -1061,10 +1059,9 @@ mod propagates_errors_to_nullable_fields {
|
||||||
}
|
}
|
||||||
|
|
||||||
mod named_operations {
|
mod named_operations {
|
||||||
use crate::schema::model::RootNode;
|
use crate::{
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode, types::scalars::EmptyMutation, value::Value, GraphQLError,
|
||||||
use crate::value::Value;
|
};
|
||||||
use crate::GraphQLError;
|
|
||||||
|
|
||||||
struct Schema;
|
struct Schema;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
mod interface {
|
mod interface {
|
||||||
use crate::schema::model::RootNode;
|
use crate::{schema::model::RootNode, types::scalars::EmptyMutation, value::Value};
|
||||||
use crate::types::scalars::EmptyMutation;
|
|
||||||
use crate::value::Value;
|
|
||||||
|
|
||||||
trait Pet {
|
trait Pet {
|
||||||
fn name(&self) -> &str;
|
fn name(&self) -> &str;
|
||||||
|
@ -157,9 +155,7 @@ mod interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
mod union {
|
mod union {
|
||||||
use crate::schema::model::RootNode;
|
use crate::{schema::model::RootNode, types::scalars::EmptyMutation, value::Value};
|
||||||
use crate::types::scalars::EmptyMutation;
|
|
||||||
use crate::value::Value;
|
|
||||||
|
|
||||||
trait Pet {
|
trait Pet {
|
||||||
fn as_dog(&self) -> Option<&Dog> {
|
fn as_dog(&self) -> Option<&Dog> {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use juniper_codegen::GraphQLEnumInternal as GraphQLEnum;
|
use juniper_codegen::GraphQLEnumInternal as GraphQLEnum;
|
||||||
|
|
||||||
use crate::executor::Variables;
|
use crate::{
|
||||||
use crate::schema::model::RootNode;
|
executor::Variables,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::value::{DefaultScalarValue, Object, Value};
|
types::scalars::EmptyMutation,
|
||||||
|
value::{DefaultScalarValue, Object, Value},
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
use juniper_codegen::GraphQLInputObjectInternal as GraphQLInputObject;
|
use juniper_codegen::GraphQLInputObjectInternal as GraphQLInputObject;
|
||||||
|
|
||||||
use crate::ast::{FromInputValue, InputValue};
|
use crate::{
|
||||||
use crate::executor::Variables;
|
ast::{FromInputValue, InputValue},
|
||||||
use crate::schema::model::RootNode;
|
executor::Variables,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::value::{DefaultScalarValue, Object, Value};
|
types::scalars::EmptyMutation,
|
||||||
|
value::{DefaultScalarValue, Object, Value},
|
||||||
|
};
|
||||||
|
|
||||||
struct Root;
|
struct Root;
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,12 @@ use juniper_codegen::GraphQLEnumInternal as GraphQLEnum;
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use self::input_object::{NamedPublic, NamedPublicWithDescription};
|
use self::input_object::{NamedPublic, NamedPublicWithDescription};
|
||||||
|
|
||||||
use crate::executor::Variables;
|
use crate::{
|
||||||
use crate::schema::model::RootNode;
|
executor::Variables,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::value::{ParseScalarResult, ParseScalarValue, Value};
|
types::scalars::EmptyMutation,
|
||||||
|
value::{ParseScalarResult, ParseScalarValue, Value},
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(GraphQLEnum)]
|
#[derive(GraphQLEnum)]
|
||||||
#[graphql(name = "SampleEnum")]
|
#[graphql(name = "SampleEnum")]
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
use juniper_codegen::GraphQLInputObjectInternal as GraphQLInputObject;
|
use juniper_codegen::GraphQLInputObjectInternal as GraphQLInputObject;
|
||||||
|
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::executor::Variables;
|
ast::InputValue,
|
||||||
use crate::parser::SourcePosition;
|
executor::Variables,
|
||||||
use crate::schema::model::RootNode;
|
parser::SourcePosition,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::validation::RuleError;
|
types::scalars::EmptyMutation,
|
||||||
use crate::value::{DefaultScalarValue, Object, ParseScalarResult, ParseScalarValue, Value};
|
validation::RuleError,
|
||||||
use crate::GraphQLError::ValidationError;
|
value::{DefaultScalarValue, Object, ParseScalarResult, ParseScalarValue, Value},
|
||||||
|
GraphQLError::ValidationError,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct TestComplexScalar;
|
struct TestComplexScalar;
|
||||||
|
|
|
@ -3,14 +3,18 @@
|
||||||
pub mod graphiql;
|
pub mod graphiql;
|
||||||
pub mod playground;
|
pub mod playground;
|
||||||
|
|
||||||
use serde::de::Deserialize;
|
use serde::{
|
||||||
use serde::ser::{self, Serialize, SerializeMap};
|
de::Deserialize,
|
||||||
|
ser::{self, Serialize, SerializeMap},
|
||||||
|
};
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::executor::ExecutionError;
|
ast::InputValue,
|
||||||
use crate::value::{DefaultScalarValue, ScalarRefValue, ScalarValue};
|
executor::ExecutionError,
|
||||||
use crate::{FieldError, GraphQLError, GraphQLType, RootNode, Value, Variables};
|
value::{DefaultScalarValue, ScalarRefValue, ScalarValue},
|
||||||
|
FieldError, GraphQLError, GraphQLType, RootNode, Value, Variables,
|
||||||
|
};
|
||||||
|
|
||||||
/// The expected structure of the decoded JSON document for either POST or GET requests.
|
/// The expected structure of the decoded JSON document for either POST or GET requests.
|
||||||
///
|
///
|
||||||
|
@ -156,8 +160,7 @@ where
|
||||||
#[cfg(any(test, feature = "expose-test-schema"))]
|
#[cfg(any(test, feature = "expose-test-schema"))]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub mod tests {
|
pub mod tests {
|
||||||
use serde_json;
|
use serde_json::{self, Value as Json};
|
||||||
use serde_json::Value as Json;
|
|
||||||
|
|
||||||
/// Normalized response content we expect to get back from
|
/// Normalized response content we expect to get back from
|
||||||
/// the http framework integration we are testing.
|
/// the http framework integration we are testing.
|
||||||
|
|
|
@ -15,9 +15,11 @@
|
||||||
*/
|
*/
|
||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
|
|
||||||
use crate::parser::{ParseError, ScalarToken, Token};
|
use crate::{
|
||||||
use crate::value::{ParseScalarResult, ParseScalarValue};
|
parser::{ParseError, ScalarToken, Token},
|
||||||
use crate::Value;
|
value::{ParseScalarResult, ParseScalarValue},
|
||||||
|
Value,
|
||||||
|
};
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub static RFC3339_FORMAT: &'static str = "%Y-%m-%dT%H:%M:%S%.f%:z";
|
pub static RFC3339_FORMAT: &'static str = "%Y-%m-%dT%H:%M:%S%.f%:z";
|
||||||
|
@ -198,13 +200,11 @@ mod test {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod integration_test {
|
mod integration_test {
|
||||||
use chrono::prelude::*;
|
use chrono::{prelude::*, Utc};
|
||||||
use chrono::Utc;
|
|
||||||
|
|
||||||
use crate::executor::Variables;
|
use crate::{
|
||||||
use crate::schema::model::RootNode;
|
executor::Variables, schema::model::RootNode, types::scalars::EmptyMutation, value::Value,
|
||||||
use crate::types::scalars::EmptyMutation;
|
};
|
||||||
use crate::value::Value;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_serialization() {
|
fn test_serialization() {
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use serde::ser::SerializeMap;
|
use serde::{
|
||||||
use serde::{de, ser};
|
de,
|
||||||
|
ser::{self, SerializeMap},
|
||||||
|
};
|
||||||
use serde_derive::Serialize;
|
use serde_derive::Serialize;
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::executor::ExecutionError;
|
ast::InputValue,
|
||||||
use crate::parser::{ParseError, SourcePosition, Spanning};
|
executor::ExecutionError,
|
||||||
use crate::validation::RuleError;
|
parser::{ParseError, SourcePosition, Spanning},
|
||||||
use crate::{GraphQLError, Object, ScalarValue, Value};
|
validation::RuleError,
|
||||||
|
GraphQLError, Object, ScalarValue, Value,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
struct SerializeHelper {
|
struct SerializeHelper {
|
||||||
|
@ -398,11 +402,12 @@ where
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{ExecutionError, GraphQLError};
|
use super::{ExecutionError, GraphQLError};
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::value::{DefaultScalarValue, Object};
|
ast::InputValue,
|
||||||
use crate::{FieldError, Value};
|
value::{DefaultScalarValue, Object},
|
||||||
use serde_json::from_str;
|
FieldError, Value,
|
||||||
use serde_json::to_string;
|
};
|
||||||
|
use serde_json::{from_str, to_string};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn int() {
|
fn int() {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use crate::value::{ParseScalarResult, ParseScalarValue};
|
use crate::{
|
||||||
use crate::Value;
|
value::{ParseScalarResult, ParseScalarValue},
|
||||||
|
Value,
|
||||||
|
};
|
||||||
|
|
||||||
graphql_scalar!(Url where Scalar = <S>{
|
graphql_scalar!(Url where Scalar = <S>{
|
||||||
description: "Url"
|
description: "Url"
|
||||||
|
|
|
@ -149,28 +149,31 @@ mod executor_tests;
|
||||||
// Needs to be public because macros use it.
|
// Needs to be public because macros use it.
|
||||||
pub use crate::util::to_camel_case;
|
pub use crate::util::to_camel_case;
|
||||||
|
|
||||||
use crate::executor::execute_validated_query;
|
use crate::{
|
||||||
use crate::introspection::{INTROSPECTION_QUERY, INTROSPECTION_QUERY_WITHOUT_DESCRIPTIONS};
|
executor::execute_validated_query,
|
||||||
use crate::parser::{parse_document_source, ParseError, Spanning};
|
introspection::{INTROSPECTION_QUERY, INTROSPECTION_QUERY_WITHOUT_DESCRIPTIONS},
|
||||||
use crate::validation::{validate_input_values, visit_all_rules, ValidatorContext};
|
parser::{parse_document_source, ParseError, Spanning},
|
||||||
|
validation::{validate_input_values, visit_all_rules, ValidatorContext},
|
||||||
|
};
|
||||||
|
|
||||||
pub use crate::ast::{FromInputValue, InputValue, Selection, ToInputValue, Type};
|
pub use crate::{
|
||||||
pub use crate::executor::{
|
ast::{FromInputValue, InputValue, Selection, ToInputValue, Type},
|
||||||
Applies, LookAheadArgument, LookAheadMethods, LookAheadSelection, LookAheadValue,
|
executor::{
|
||||||
};
|
Applies, Context, ExecutionError, ExecutionResult, Executor, FieldError, FieldResult,
|
||||||
pub use crate::executor::{
|
FromContext, IntoFieldError, IntoResolvable, LookAheadArgument, LookAheadMethods,
|
||||||
Context, ExecutionError, ExecutionResult, Executor, FieldError, FieldResult, FromContext,
|
LookAheadSelection, LookAheadValue, Registry, Variables,
|
||||||
IntoFieldError, IntoResolvable, Registry, Variables,
|
},
|
||||||
};
|
introspection::IntrospectionFormat,
|
||||||
pub use crate::introspection::IntrospectionFormat;
|
schema::{meta, model::RootNode},
|
||||||
pub use crate::schema::meta;
|
types::{
|
||||||
pub use crate::schema::model::RootNode;
|
base::{Arguments, GraphQLType, TypeKind},
|
||||||
pub use crate::types::base::{Arguments, GraphQLType, TypeKind};
|
scalars::{EmptyMutation, ID},
|
||||||
pub use crate::types::scalars::{EmptyMutation, ID};
|
},
|
||||||
pub use crate::validation::RuleError;
|
validation::RuleError,
|
||||||
pub use crate::value::{
|
value::{
|
||||||
DefaultScalarValue, Object, ParseScalarResult, ParseScalarValue, ScalarRefValue, ScalarValue,
|
DefaultScalarValue, Object, ParseScalarResult, ParseScalarValue, ScalarRefValue,
|
||||||
Value,
|
ScalarValue, Value,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// An error that prevented query execution
|
/// An error that prevented query execution
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use juniper_codegen::GraphQLInputObjectInternal as GraphQLInputObject;
|
use juniper_codegen::GraphQLInputObjectInternal as GraphQLInputObject;
|
||||||
|
|
||||||
use crate::executor::Variables;
|
use crate::{
|
||||||
use crate::schema::model::RootNode;
|
executor::Variables,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::value::{DefaultScalarValue, Value};
|
types::scalars::EmptyMutation,
|
||||||
|
value::{DefaultScalarValue, Value},
|
||||||
|
};
|
||||||
|
|
||||||
struct Root;
|
struct Root;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::executor::FieldResult;
|
ast::InputValue,
|
||||||
use crate::schema::model::RootNode;
|
executor::FieldResult,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::value::{DefaultScalarValue, Object, Value};
|
types::scalars::EmptyMutation,
|
||||||
|
value::{DefaultScalarValue, Object, Value},
|
||||||
|
};
|
||||||
|
|
||||||
struct Interface;
|
struct Interface;
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::schema::model::RootNode;
|
ast::InputValue,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::value::{DefaultScalarValue, Object, Value};
|
types::scalars::EmptyMutation,
|
||||||
|
value::{DefaultScalarValue, Object, Value},
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::executor::{Context, FieldResult};
|
ast::InputValue,
|
||||||
use crate::schema::model::RootNode;
|
executor::{Context, FieldResult},
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::value::{DefaultScalarValue, Object, Value};
|
types::scalars::EmptyMutation,
|
||||||
|
value::{DefaultScalarValue, Object, Value},
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::executor::Variables;
|
use crate::{
|
||||||
use crate::schema::model::RootNode;
|
executor::Variables,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::value::{DefaultScalarValue, Object, ParseScalarResult, ParseScalarValue, Value};
|
types::scalars::EmptyMutation,
|
||||||
|
value::{DefaultScalarValue, Object, ParseScalarResult, ParseScalarValue, Value},
|
||||||
|
};
|
||||||
|
|
||||||
struct DefaultName(i32);
|
struct DefaultName(i32);
|
||||||
struct OtherOrder(i32);
|
struct OtherOrder(i32);
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::schema::model::RootNode;
|
ast::InputValue,
|
||||||
use crate::types::scalars::EmptyMutation;
|
schema::model::RootNode,
|
||||||
use crate::value::{DefaultScalarValue, Object, Value};
|
types::scalars::EmptyMutation,
|
||||||
|
value::{DefaultScalarValue, Object, Value},
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,17 @@ use crate::ast::{
|
||||||
InputValue, Operation, OperationType, Selection, Type, VariableDefinition, VariableDefinitions,
|
InputValue, Operation, OperationType, Selection, Type, VariableDefinition, VariableDefinitions,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::parser::value::parse_value_literal;
|
use crate::{
|
||||||
use crate::parser::{
|
parser::{
|
||||||
Lexer, OptionParseResult, ParseError, ParseResult, Parser, Spanning, Token,
|
value::parse_value_literal, Lexer, OptionParseResult, ParseError, ParseResult, Parser,
|
||||||
UnlocatedParseResult,
|
Spanning, Token, UnlocatedParseResult,
|
||||||
|
},
|
||||||
|
schema::{
|
||||||
|
meta::{Argument, Field as MetaField},
|
||||||
|
model::SchemaType,
|
||||||
|
},
|
||||||
|
value::ScalarValue,
|
||||||
};
|
};
|
||||||
use crate::schema::meta::{Argument, Field as MetaField};
|
|
||||||
use crate::schema::model::SchemaType;
|
|
||||||
use crate::value::ScalarValue;
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn parse_document_source<'a, 'b, S>(
|
pub fn parse_document_source<'a, 'b, S>(
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use std::char;
|
use std::{
|
||||||
use std::fmt;
|
char, fmt,
|
||||||
use std::iter::{Iterator, Peekable};
|
iter::{Iterator, Peekable},
|
||||||
use std::result::Result;
|
result::Result,
|
||||||
use std::str::CharIndices;
|
str::CharIndices,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::parser::{SourcePosition, Spanning};
|
use crate::parser::{SourcePosition, Spanning};
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ mod tests;
|
||||||
|
|
||||||
pub use self::document::parse_document_source;
|
pub use self::document::parse_document_source;
|
||||||
|
|
||||||
pub use self::lexer::{Lexer, LexerError, ScalarToken, Token};
|
pub use self::{
|
||||||
pub use self::parser::{OptionParseResult, ParseError, ParseResult, Parser, UnlocatedParseResult};
|
lexer::{Lexer, LexerError, ScalarToken, Token},
|
||||||
pub use self::utils::{SourcePosition, Spanning};
|
parser::{OptionParseResult, ParseError, ParseResult, Parser, UnlocatedParseResult},
|
||||||
|
utils::{SourcePosition, Spanning},
|
||||||
|
};
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use std::fmt;
|
use std::{fmt, result::Result};
|
||||||
use std::result::Result;
|
|
||||||
|
|
||||||
use crate::parser::{Lexer, LexerError, Spanning, Token};
|
use crate::parser::{Lexer, LexerError, Spanning, Token};
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
use crate::ast::{
|
use crate::{
|
||||||
Arguments, Definition, Document, Field, InputValue, Operation, OperationType, Selection,
|
ast::{
|
||||||
|
Arguments, Definition, Document, Field, InputValue, Operation, OperationType, Selection,
|
||||||
|
},
|
||||||
|
parser::{document::parse_document_source, ParseError, SourcePosition, Spanning, Token},
|
||||||
|
schema::model::SchemaType,
|
||||||
|
validation::test_harness::{MutationRoot, QueryRoot},
|
||||||
|
value::{DefaultScalarValue, ScalarRefValue, ScalarValue},
|
||||||
};
|
};
|
||||||
use crate::parser::document::parse_document_source;
|
|
||||||
use crate::parser::{ParseError, SourcePosition, Spanning, Token};
|
|
||||||
use crate::schema::model::SchemaType;
|
|
||||||
use crate::validation::test_harness::{MutationRoot, QueryRoot};
|
|
||||||
use crate::value::{DefaultScalarValue, ScalarRefValue, ScalarValue};
|
|
||||||
|
|
||||||
fn parse_document<S>(s: &str) -> Document<S>
|
fn parse_document<S>(s: &str) -> Document<S>
|
||||||
where
|
where
|
||||||
|
|
|
@ -4,14 +4,19 @@ use juniper_codegen::{
|
||||||
GraphQLEnumInternal as GraphQLEnum, GraphQLInputObjectInternal as GraphQLInputObject,
|
GraphQLEnumInternal as GraphQLEnum, GraphQLInputObjectInternal as GraphQLInputObject,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::ast::{FromInputValue, InputValue, Type};
|
use crate::{
|
||||||
use crate::parser::value::parse_value_literal;
|
ast::{FromInputValue, InputValue, Type},
|
||||||
use crate::parser::{Lexer, Parser, SourcePosition, Spanning};
|
parser::{value::parse_value_literal, Lexer, Parser, SourcePosition, Spanning},
|
||||||
use crate::value::{DefaultScalarValue, ParseScalarValue, ScalarRefValue, ScalarValue};
|
value::{DefaultScalarValue, ParseScalarValue, ScalarRefValue, ScalarValue},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::schema::meta::{Argument, EnumMeta, EnumValue, InputObjectMeta, MetaType, ScalarMeta};
|
use crate::{
|
||||||
use crate::schema::model::SchemaType;
|
schema::{
|
||||||
use crate::types::scalars::EmptyMutation;
|
meta::{Argument, EnumMeta, EnumValue, InputObjectMeta, MetaType, ScalarMeta},
|
||||||
|
model::SchemaType,
|
||||||
|
},
|
||||||
|
types::scalars::EmptyMutation,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(GraphQLEnum)]
|
#[derive(GraphQLEnum)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
use crate::ast::InputValue;
|
use crate::ast::InputValue;
|
||||||
|
|
||||||
use crate::parser::{
|
use crate::{
|
||||||
ParseError, ParseResult, Parser, ScalarToken, SourcePosition, Spanning, Token,
|
parser::{ParseError, ParseResult, Parser, ScalarToken, SourcePosition, Spanning, Token},
|
||||||
|
schema::{
|
||||||
|
meta::{InputObjectMeta, MetaType},
|
||||||
|
model::SchemaType,
|
||||||
|
},
|
||||||
|
value::ScalarValue,
|
||||||
};
|
};
|
||||||
use crate::schema::meta::{InputObjectMeta, MetaType};
|
|
||||||
use crate::schema::model::SchemaType;
|
|
||||||
use crate::value::ScalarValue;
|
|
||||||
|
|
||||||
pub fn parse_value_literal<'a, 'b, S>(
|
pub fn parse_value_literal<'a, 'b, S>(
|
||||||
parser: &mut Parser<'a>,
|
parser: &mut Parser<'a>,
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
//! Types used to describe a `GraphQL` schema
|
//! Types used to describe a `GraphQL` schema
|
||||||
|
|
||||||
use std::borrow::{Cow, ToOwned};
|
use std::{
|
||||||
use std::fmt;
|
borrow::{Cow, ToOwned},
|
||||||
|
fmt,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::ast::{FromInputValue, InputValue, Type};
|
use crate::{
|
||||||
use crate::parser::{ParseError, ScalarToken};
|
ast::{FromInputValue, InputValue, Type},
|
||||||
use crate::schema::model::SchemaType;
|
parser::{ParseError, ScalarToken},
|
||||||
use crate::types::base::TypeKind;
|
schema::model::SchemaType,
|
||||||
use crate::value::{DefaultScalarValue, ParseScalarValue, ScalarRefValue, ScalarValue};
|
types::base::TypeKind,
|
||||||
|
value::{DefaultScalarValue, ParseScalarValue, ScalarRefValue, ScalarValue},
|
||||||
|
};
|
||||||
|
|
||||||
/// Whether an item is deprecated, with context.
|
/// Whether an item is deprecated, with context.
|
||||||
#[derive(Debug, PartialEq, Hash, Clone)]
|
#[derive(Debug, PartialEq, Hash, Clone)]
|
||||||
|
|
|
@ -4,14 +4,13 @@ use fnv::FnvHashMap;
|
||||||
|
|
||||||
use juniper_codegen::GraphQLEnumInternal as GraphQLEnum;
|
use juniper_codegen::GraphQLEnumInternal as GraphQLEnum;
|
||||||
|
|
||||||
use crate::ast::Type;
|
use crate::{
|
||||||
use crate::executor::{Context, Registry};
|
ast::Type,
|
||||||
use crate::schema::meta::{
|
executor::{Context, Registry},
|
||||||
Argument, InterfaceMeta, MetaType, ObjectMeta, PlaceholderMeta, UnionMeta,
|
schema::meta::{Argument, InterfaceMeta, MetaType, ObjectMeta, PlaceholderMeta, UnionMeta},
|
||||||
|
types::{base::GraphQLType, name::Name},
|
||||||
|
value::{DefaultScalarValue, ScalarRefValue, ScalarValue},
|
||||||
};
|
};
|
||||||
use crate::types::base::GraphQLType;
|
|
||||||
use crate::types::name::Name;
|
|
||||||
use crate::value::{DefaultScalarValue, ScalarRefValue, ScalarValue};
|
|
||||||
|
|
||||||
/// Root query node of a schema
|
/// Root query node of a schema
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
use crate::ast::Selection;
|
use crate::{
|
||||||
use crate::executor::{ExecutionResult, Executor, Registry};
|
ast::Selection,
|
||||||
use crate::types::base::{Arguments, GraphQLType, TypeKind};
|
executor::{ExecutionResult, Executor, Registry},
|
||||||
use crate::value::{ScalarRefValue, ScalarValue, Value};
|
types::base::{Arguments, GraphQLType, TypeKind},
|
||||||
|
value::{ScalarRefValue, ScalarValue, Value},
|
||||||
use crate::schema::meta::{
|
};
|
||||||
Argument, EnumMeta, EnumValue, Field, InputObjectMeta, InterfaceMeta, MetaType, ObjectMeta,
|
|
||||||
UnionMeta,
|
use crate::schema::{
|
||||||
|
meta::{
|
||||||
|
Argument, EnumMeta, EnumValue, Field, InputObjectMeta, InterfaceMeta, MetaType, ObjectMeta,
|
||||||
|
UnionMeta,
|
||||||
|
},
|
||||||
|
model::{DirectiveLocation, DirectiveType, RootNode, SchemaType, TypeType},
|
||||||
};
|
};
|
||||||
use crate::schema::model::{DirectiveLocation, DirectiveType, RootNode, SchemaType, TypeType};
|
|
||||||
|
|
||||||
impl<'a, CtxT, S, QueryT, MutationT> GraphQLType<S> for RootNode<'a, QueryT, MutationT, S>
|
impl<'a, CtxT, S, QueryT, MutationT> GraphQLType<S> for RootNode<'a, QueryT, MutationT, S>
|
||||||
where
|
where
|
||||||
|
@ -58,8 +62,7 @@ where
|
||||||
selection_set: Option<&[Selection<S>]>,
|
selection_set: Option<&[Selection<S>]>,
|
||||||
executor: &Executor<Self::Context, S>,
|
executor: &Executor<Self::Context, S>,
|
||||||
) -> Value<S> {
|
) -> Value<S> {
|
||||||
use crate::types::base::resolve_selection_set_into;
|
use crate::{types::base::resolve_selection_set_into, value::Object};
|
||||||
use crate::value::Object;
|
|
||||||
if let Some(selection_set) = selection_set {
|
if let Some(selection_set) = selection_set {
|
||||||
let mut result = Object::with_capacity(selection_set.len());
|
let mut result = Object::with_capacity(selection_set.len());
|
||||||
if resolve_selection_set_into(self, info, selection_set, executor, &mut result) {
|
if resolve_selection_set_into(self, info, selection_set, executor, &mut result) {
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use super::schema_introspection::*;
|
use super::schema_introspection::*;
|
||||||
use crate::executor::Variables;
|
use crate::{
|
||||||
use crate::introspection::IntrospectionFormat;
|
executor::Variables,
|
||||||
use crate::schema::model::RootNode;
|
introspection::IntrospectionFormat,
|
||||||
use crate::tests::model::Database;
|
schema::model::RootNode,
|
||||||
use crate::tests::schema::Query;
|
tests::{model::Database, schema::Query},
|
||||||
use crate::types::scalars::EmptyMutation;
|
types::scalars::EmptyMutation,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_introspection_query_type_name() {
|
fn test_introspection_query_type_name() {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::executor::Variables;
|
ast::InputValue,
|
||||||
use crate::schema::model::RootNode;
|
executor::Variables,
|
||||||
use crate::tests::model::Database;
|
schema::model::RootNode,
|
||||||
use crate::tests::schema::Query;
|
tests::{model::Database, schema::Query},
|
||||||
use crate::types::scalars::EmptyMutation;
|
types::scalars::EmptyMutation,
|
||||||
use crate::value::Value;
|
value::Value,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hero_name() {
|
fn test_hero_name() {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
use crate::executor::Context;
|
use crate::{
|
||||||
use crate::tests::model::{Character, Database, Droid, Episode, Human};
|
executor::Context,
|
||||||
|
tests::model::{Character, Database, Droid, Episode, Human},
|
||||||
|
};
|
||||||
|
|
||||||
impl Context for Database {}
|
impl Context for Database {}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
use crate::value::{self, Value, Value::Null};
|
use crate::value::{
|
||||||
|
self,
|
||||||
|
Value::{self, Null},
|
||||||
|
};
|
||||||
|
|
||||||
// Sort a nested schema Value.
|
// Sort a nested schema Value.
|
||||||
// In particular, lists are sorted by the "name" key of children, if present.
|
// In particular, lists are sorted by the "name" key of children, if present.
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
|
|
||||||
use crate::executor::{ExecutionResult, Executor, Registry, Variables};
|
use crate::{
|
||||||
use crate::schema::meta::MetaType;
|
executor::{ExecutionResult, Executor, Registry, Variables},
|
||||||
use crate::schema::model::RootNode;
|
schema::{meta::MetaType, model::RootNode},
|
||||||
use crate::types::base::{Arguments, GraphQLType};
|
types::{
|
||||||
use crate::types::scalars::EmptyMutation;
|
base::{Arguments, GraphQLType},
|
||||||
use crate::value::{ScalarRefValue, ScalarValue, Value};
|
scalars::EmptyMutation,
|
||||||
|
},
|
||||||
|
value::{ScalarRefValue, ScalarValue, Value},
|
||||||
|
};
|
||||||
|
|
||||||
pub struct NodeTypeInfo {
|
pub struct NodeTypeInfo {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -2,13 +2,17 @@ use indexmap::IndexMap;
|
||||||
|
|
||||||
use juniper_codegen::GraphQLEnumInternal as GraphQLEnum;
|
use juniper_codegen::GraphQLEnumInternal as GraphQLEnum;
|
||||||
|
|
||||||
use crate::ast::{Directive, FromInputValue, InputValue, Selection};
|
use crate::{
|
||||||
use crate::executor::Variables;
|
ast::{Directive, FromInputValue, InputValue, Selection},
|
||||||
use crate::value::{DefaultScalarValue, Object, ScalarRefValue, ScalarValue, Value};
|
executor::Variables,
|
||||||
|
value::{DefaultScalarValue, Object, ScalarRefValue, ScalarValue, Value},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::executor::{ExecutionResult, Executor, Registry};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
executor::{ExecutionResult, Executor, Registry},
|
||||||
use crate::schema::meta::{Argument, MetaType};
|
parser::Spanning,
|
||||||
|
schema::meta::{Argument, MetaType},
|
||||||
|
};
|
||||||
|
|
||||||
/// GraphQL type kind
|
/// GraphQL type kind
|
||||||
///
|
///
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
use crate::ast::{FromInputValue, InputValue, Selection, ToInputValue};
|
use crate::{
|
||||||
use crate::schema::meta::MetaType;
|
ast::{FromInputValue, InputValue, Selection, ToInputValue},
|
||||||
use crate::value::{ScalarRefValue, ScalarValue, Value};
|
schema::meta::MetaType,
|
||||||
|
value::{ScalarRefValue, ScalarValue, Value},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::executor::{Executor, Registry};
|
use crate::{
|
||||||
use crate::types::base::GraphQLType;
|
executor::{Executor, Registry},
|
||||||
|
types::base::GraphQLType,
|
||||||
|
};
|
||||||
|
|
||||||
impl<S, T, CtxT> GraphQLType<S> for Option<T>
|
impl<S, T, CtxT> GraphQLType<S> for Option<T>
|
||||||
where
|
where
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use std::borrow::Borrow;
|
use std::{
|
||||||
use std::error::Error;
|
borrow::Borrow,
|
||||||
use std::fmt::{Display, Formatter, Result as FmtResult};
|
error::Error,
|
||||||
use std::str::FromStr;
|
fmt::{Display, Formatter, Result as FmtResult},
|
||||||
|
str::FromStr,
|
||||||
|
};
|
||||||
|
|
||||||
// Helper functions until the corresponding AsciiExt methods
|
// Helper functions until the corresponding AsciiExt methods
|
||||||
// stabilise (https://github.com/rust-lang/rust/issues/39658).
|
// stabilise (https://github.com/rust-lang/rust/issues/39658).
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
use crate::ast::{FromInputValue, InputValue, Selection, ToInputValue};
|
use crate::ast::{FromInputValue, InputValue, Selection, ToInputValue};
|
||||||
use std::fmt::Debug;
|
use std::{fmt::Debug, sync::Arc};
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use crate::executor::{ExecutionResult, Executor, Registry};
|
use crate::{
|
||||||
use crate::schema::meta::MetaType;
|
executor::{ExecutionResult, Executor, Registry},
|
||||||
use crate::types::base::{Arguments, GraphQLType};
|
schema::meta::MetaType,
|
||||||
use crate::value::{ScalarRefValue, ScalarValue, Value};
|
types::base::{Arguments, GraphQLType},
|
||||||
|
value::{ScalarRefValue, ScalarValue, Value},
|
||||||
|
};
|
||||||
|
|
||||||
impl<S, T, CtxT> GraphQLType<S> for Box<T>
|
impl<S, T, CtxT> GraphQLType<S> for Box<T>
|
||||||
where
|
where
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use std::convert::From;
|
use std::{char, convert::From, marker::PhantomData, ops::Deref, u32};
|
||||||
use std::marker::PhantomData;
|
|
||||||
use std::ops::Deref;
|
|
||||||
use std::{char, u32};
|
|
||||||
|
|
||||||
use crate::ast::{InputValue, Selection, ToInputValue};
|
use crate::{
|
||||||
use crate::executor::{Executor, Registry};
|
ast::{InputValue, Selection, ToInputValue},
|
||||||
use crate::parser::{LexerError, ParseError, ScalarToken, Token};
|
executor::{Executor, Registry},
|
||||||
use crate::schema::meta::MetaType;
|
parser::{LexerError, ParseError, ScalarToken, Token},
|
||||||
use crate::types::base::GraphQLType;
|
schema::meta::MetaType,
|
||||||
use crate::value::{ParseScalarResult, ScalarRefValue, ScalarValue, Value};
|
types::base::GraphQLType,
|
||||||
|
value::{ParseScalarResult, ScalarRefValue, ScalarValue, Value},
|
||||||
|
};
|
||||||
|
|
||||||
/// An ID as defined by the GraphQL specification
|
/// An ID as defined by the GraphQL specification
|
||||||
///
|
///
|
||||||
|
@ -316,8 +315,10 @@ where
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::ID;
|
use super::ID;
|
||||||
use crate::parser::ScalarToken;
|
use crate::{
|
||||||
use crate::value::{DefaultScalarValue, ParseScalarValue};
|
parser::ScalarToken,
|
||||||
|
value::{DefaultScalarValue, ParseScalarValue},
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_id_from_string() {
|
fn test_id_from_string() {
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::schema::meta::{EnumMeta, InputObjectMeta, MetaType};
|
ast::InputValue,
|
||||||
use crate::schema::model::{SchemaType, TypeType};
|
schema::{
|
||||||
use crate::value::ScalarValue;
|
meta::{EnumMeta, InputObjectMeta, MetaType},
|
||||||
|
model::{SchemaType, TypeType},
|
||||||
|
},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
pub fn is_valid_literal_value<S>(
|
pub fn is_valid_literal_value<S>(
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
use std::collections::HashSet;
|
use std::{collections::HashSet, fmt::Debug};
|
||||||
use std::fmt::Debug;
|
|
||||||
|
|
||||||
use crate::ast::{Definition, Document, Type};
|
use crate::ast::{Definition, Document, Type};
|
||||||
|
|
||||||
use crate::schema::meta::MetaType;
|
use crate::schema::{meta::MetaType, model::SchemaType};
|
||||||
use crate::schema::model::SchemaType;
|
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::parser::SourcePosition;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
use std::collections::HashSet;
|
use std::{collections::HashSet, fmt};
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
use crate::ast::{Definition, Document, InputValue, VariableDefinitions};
|
use crate::{
|
||||||
use crate::executor::Variables;
|
ast::{Definition, Document, InputValue, VariableDefinitions},
|
||||||
use crate::parser::SourcePosition;
|
executor::Variables,
|
||||||
use crate::schema::meta::{EnumMeta, InputObjectMeta, MetaType, ScalarMeta};
|
parser::SourcePosition,
|
||||||
use crate::schema::model::{SchemaType, TypeType};
|
schema::{
|
||||||
use crate::validation::RuleError;
|
meta::{EnumMeta, InputObjectMeta, MetaType, ScalarMeta},
|
||||||
use crate::value::{ScalarRefValue, ScalarValue};
|
model::{SchemaType, TypeType},
|
||||||
|
},
|
||||||
|
validation::RuleError,
|
||||||
|
value::{ScalarRefValue, ScalarValue},
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum Path<'a> {
|
enum Path<'a> {
|
||||||
|
|
|
@ -10,12 +10,14 @@ mod visitor;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) mod test_harness;
|
pub(crate) mod test_harness;
|
||||||
|
|
||||||
pub use self::context::{RuleError, ValidatorContext};
|
|
||||||
pub use self::input_value::validate_input_values;
|
|
||||||
pub use self::multi_visitor::MultiVisitorNil;
|
|
||||||
pub(crate) use self::rules::visit_all_rules;
|
pub(crate) use self::rules::visit_all_rules;
|
||||||
pub use self::traits::Visitor;
|
pub use self::{
|
||||||
pub use self::visitor::visit;
|
context::{RuleError, ValidatorContext},
|
||||||
|
input_value::validate_input_values,
|
||||||
|
multi_visitor::MultiVisitorNil,
|
||||||
|
traits::Visitor,
|
||||||
|
visitor::visit,
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub use self::test_harness::{
|
pub use self::test_harness::{
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
use crate::ast::{
|
use crate::{
|
||||||
Directive, Document, Field, Fragment, FragmentSpread, InlineFragment, InputValue, Operation,
|
ast::{
|
||||||
Selection, VariableDefinition,
|
Directive, Document, Field, Fragment, FragmentSpread, InlineFragment, InputValue,
|
||||||
|
Operation, Selection, VariableDefinition,
|
||||||
|
},
|
||||||
|
parser::Spanning,
|
||||||
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
};
|
};
|
||||||
use crate::parser::Spanning;
|
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
|
||||||
use crate::value::ScalarValue;
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub struct MultiVisitorNil;
|
pub struct MultiVisitorNil;
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use crate::ast::{Directive, Field, InputValue};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::{Directive, Field, InputValue},
|
||||||
use crate::schema::meta::Argument;
|
parser::Spanning,
|
||||||
use crate::types::utilities::is_valid_literal_value;
|
schema::meta::Argument,
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
types::utilities::is_valid_literal_value,
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
pub struct ArgumentsOfCorrectType<'a, S: Debug + 'a> {
|
pub struct ArgumentsOfCorrectType<'a, S: Debug + 'a> {
|
||||||
|
@ -76,9 +78,11 @@ fn error_message(arg_name: &str, type_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn good_null_value() {
|
fn good_null_value() {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use crate::ast::VariableDefinition;
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::VariableDefinition,
|
||||||
use crate::types::utilities::is_valid_literal_value;
|
parser::Spanning,
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
types::utilities::is_valid_literal_value,
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct DefaultValuesOfCorrectType;
|
pub struct DefaultValuesOfCorrectType;
|
||||||
|
|
||||||
|
@ -62,9 +64,11 @@ fn non_null_error_message(arg_name: &str, type_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{factory, non_null_error_message, type_error_message};
|
use super::{factory, non_null_error_message, type_error_message};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn variables_with_no_default_values() {
|
fn variables_with_no_default_values() {
|
||||||
|
@ -189,5 +193,4 @@ mod tests {
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use crate::ast::Field;
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::Field,
|
||||||
use crate::schema::meta::MetaType;
|
parser::Spanning,
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
schema::meta::MetaType,
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct FieldsOnCorrectType;
|
pub struct FieldsOnCorrectType;
|
||||||
|
|
||||||
|
@ -55,9 +57,11 @@ fn error_message(field: &str, type_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn selection_on_object() {
|
fn selection_on_object() {
|
||||||
|
@ -356,5 +360,4 @@ mod tests {
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::ast::{Fragment, InlineFragment};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::{Fragment, InlineFragment},
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
parser::Spanning,
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct FragmentsOnCompositeTypes;
|
pub struct FragmentsOnCompositeTypes;
|
||||||
|
|
||||||
|
@ -73,9 +75,11 @@ fn error_message(fragment_name: Option<&str>, on_type: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn on_object() {
|
fn on_object() {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use crate::ast::{Directive, Field, InputValue};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::{Directive, Field, InputValue},
|
||||||
use crate::schema::meta::Argument;
|
parser::Spanning,
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
schema::meta::Argument,
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -106,9 +108,11 @@ fn directive_error_message(arg_name: &str, directive_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{directive_error_message, factory, field_error_message};
|
use super::{directive_error_message, factory, field_error_message};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn single_arg_is_known() {
|
fn single_arg_is_known() {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
use crate::ast::{
|
use crate::{
|
||||||
Directive, Field, Fragment, FragmentSpread, InlineFragment, Operation, OperationType,
|
ast::{Directive, Field, Fragment, FragmentSpread, InlineFragment, Operation, OperationType},
|
||||||
|
parser::Spanning,
|
||||||
|
schema::model::DirectiveLocation,
|
||||||
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
};
|
};
|
||||||
use crate::parser::Spanning;
|
|
||||||
use crate::schema::model::DirectiveLocation;
|
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
|
||||||
use crate::value::ScalarValue;
|
|
||||||
|
|
||||||
pub struct KnownDirectives {
|
pub struct KnownDirectives {
|
||||||
location_stack: Vec<DirectiveLocation>,
|
location_stack: Vec<DirectiveLocation>,
|
||||||
|
@ -143,10 +143,12 @@ fn misplaced_error_message(directive_name: &str, location: &DirectiveLocation) -
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{factory, misplaced_error_message, unknown_error_message};
|
use super::{factory, misplaced_error_message, unknown_error_message};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::schema::model::DirectiveLocation;
|
parser::SourcePosition,
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
schema::model::DirectiveLocation,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn with_no_directives() {
|
fn with_no_directives() {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::ast::FragmentSpread;
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::FragmentSpread,
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
parser::Spanning,
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct KnownFragmentNames;
|
pub struct KnownFragmentNames;
|
||||||
|
|
||||||
|
@ -33,9 +35,11 @@ fn error_message(frag_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn known() {
|
fn known() {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::ast::{Fragment, InlineFragment, VariableDefinition};
|
use crate::{
|
||||||
use crate::parser::{SourcePosition, Spanning};
|
ast::{Fragment, InlineFragment, VariableDefinition},
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
parser::{SourcePosition, Spanning},
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
pub struct KnownTypeNames;
|
pub struct KnownTypeNames;
|
||||||
|
@ -61,9 +63,11 @@ fn error_message(type_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn known_type_names_are_valid() {
|
fn known_type_names_are_valid() {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::ast::{Definition, Document, Operation};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::{Definition, Document, Operation},
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
parser::Spanning,
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct LoneAnonymousOperation {
|
pub struct LoneAnonymousOperation {
|
||||||
operation_count: Option<usize>,
|
operation_count: Option<usize>,
|
||||||
|
@ -49,9 +51,11 @@ fn error_message() -> &'static str {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_operations() {
|
fn no_operations() {
|
||||||
|
|
|
@ -23,9 +23,11 @@ mod unique_variable_names;
|
||||||
mod variables_are_input_types;
|
mod variables_are_input_types;
|
||||||
mod variables_in_allowed_position;
|
mod variables_in_allowed_position;
|
||||||
|
|
||||||
use crate::ast::Document;
|
use crate::{
|
||||||
use crate::validation::{visit, MultiVisitorNil, ValidatorContext};
|
ast::Document,
|
||||||
use crate::value::ScalarValue;
|
validation::{visit, MultiVisitorNil, ValidatorContext},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
pub(crate) fn visit_all_rules<'a, S: Debug>(ctx: &mut ValidatorContext<'a, S>, doc: &'a Document<S>)
|
pub(crate) fn visit_all_rules<'a, S: Debug>(ctx: &mut ValidatorContext<'a, S>, doc: &'a Document<S>)
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
use crate::ast::{Document, Fragment, FragmentSpread};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::{Document, Fragment, FragmentSpread},
|
||||||
use crate::validation::{RuleError, ValidatorContext, Visitor};
|
parser::Spanning,
|
||||||
use crate::value::ScalarValue;
|
validation::{RuleError, ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct NoFragmentCycles<'a> {
|
pub struct NoFragmentCycles<'a> {
|
||||||
current_fragment: Option<&'a str>,
|
current_fragment: Option<&'a str>,
|
||||||
|
@ -133,9 +135,11 @@ fn error_message(frag_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn single_reference_is_valid() {
|
fn single_reference_is_valid() {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::ast::{Document, Fragment, FragmentSpread, InputValue, Operation, VariableDefinition};
|
use crate::{
|
||||||
use crate::parser::{SourcePosition, Spanning};
|
ast::{Document, Fragment, FragmentSpread, InputValue, Operation, VariableDefinition},
|
||||||
use crate::validation::{RuleError, ValidatorContext, Visitor};
|
parser::{SourcePosition, Spanning},
|
||||||
use crate::value::ScalarValue;
|
validation::{RuleError, ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
|
@ -162,9 +164,11 @@ fn error_message(var_name: &str, op_name: Option<&str>) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn all_variables_defined() {
|
fn all_variables_defined() {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
use crate::ast::{Definition, Document, Fragment, FragmentSpread, Operation};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::{Definition, Document, Fragment, FragmentSpread, Operation},
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
parser::Spanning,
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum Scope<'a> {
|
pub enum Scope<'a> {
|
||||||
|
@ -109,9 +111,11 @@ fn error_message(frag_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn all_fragment_names_are_used() {
|
fn all_fragment_names_are_used() {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::ast::{Document, Fragment, FragmentSpread, InputValue, Operation, VariableDefinition};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::{Document, Fragment, FragmentSpread, InputValue, Operation, VariableDefinition},
|
||||||
use crate::validation::{RuleError, ValidatorContext, Visitor};
|
parser::Spanning,
|
||||||
use crate::value::ScalarValue;
|
validation::{RuleError, ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
|
@ -153,9 +155,11 @@ fn error_message(var_name: &str, op_name: Option<&str>) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn uses_all_variables() {
|
fn uses_all_variables() {
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
use crate::ast::{
|
use crate::{
|
||||||
Arguments, Definition, Document, Field, Fragment, FragmentSpread, Selection, Type,
|
ast::{Arguments, Definition, Document, Field, Fragment, FragmentSpread, Selection, Type},
|
||||||
|
parser::{SourcePosition, Spanning},
|
||||||
|
schema::meta::{Field as FieldType, MetaType},
|
||||||
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
};
|
};
|
||||||
use crate::parser::{SourcePosition, Spanning};
|
use std::{borrow::Borrow, cell::RefCell, collections::HashMap, fmt::Debug, hash::Hash};
|
||||||
use crate::schema::meta::{Field as FieldType, MetaType};
|
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
|
||||||
use crate::value::ScalarValue;
|
|
||||||
use std::borrow::Borrow;
|
|
||||||
use std::cell::RefCell;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::fmt::Debug;
|
|
||||||
use std::hash::Hash;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Conflict(ConflictReason, Vec<SourcePosition>, Vec<SourcePosition>);
|
struct Conflict(ConflictReason, Vec<SourcePosition>, Vec<SourcePosition>);
|
||||||
|
@ -739,20 +735,25 @@ fn format_reason(reason: &ConflictReasonMessage) -> String {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::ConflictReasonMessage::*;
|
use super::{error_message, factory, ConflictReason, ConflictReasonMessage::*};
|
||||||
use super::{error_message, factory, ConflictReason};
|
|
||||||
|
|
||||||
use crate::executor::Registry;
|
use crate::{
|
||||||
use crate::schema::meta::MetaType;
|
executor::Registry,
|
||||||
use crate::types::base::GraphQLType;
|
schema::meta::MetaType,
|
||||||
use crate::types::scalars::{EmptyMutation, ID};
|
types::{
|
||||||
|
base::GraphQLType,
|
||||||
use crate::parser::SourcePosition;
|
scalars::{EmptyMutation, ID},
|
||||||
use crate::validation::{
|
},
|
||||||
expect_fails_rule, expect_fails_rule_with_schema, expect_passes_rule,
|
};
|
||||||
expect_passes_rule_with_schema, RuleError,
|
|
||||||
|
use crate::{
|
||||||
|
parser::SourcePosition,
|
||||||
|
validation::{
|
||||||
|
expect_fails_rule, expect_fails_rule_with_schema, expect_passes_rule,
|
||||||
|
expect_passes_rule_with_schema, RuleError,
|
||||||
|
},
|
||||||
|
value::{DefaultScalarValue, ScalarRefValue, ScalarValue},
|
||||||
};
|
};
|
||||||
use crate::value::{DefaultScalarValue, ScalarRefValue, ScalarValue};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn unique_fields() {
|
fn unique_fields() {
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use crate::ast::{Definition, Document, FragmentSpread, InlineFragment};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::{Definition, Document, FragmentSpread, InlineFragment},
|
||||||
use crate::schema::meta::MetaType;
|
parser::Spanning,
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
schema::meta::MetaType,
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub struct PossibleFragmentSpreads<'a, S: Debug + 'a> {
|
pub struct PossibleFragmentSpreads<'a, S: Debug + 'a> {
|
||||||
|
@ -99,9 +101,11 @@ fn error_message(frag_name: Option<&str>, parent_type_name: &str, frag_type: &st
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn of_the_same_object() {
|
fn of_the_same_object() {
|
||||||
|
@ -390,5 +394,4 @@ mod tests {
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
use crate::ast::{Directive, Field};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::{Directive, Field},
|
||||||
use crate::schema::meta::Field as FieldType;
|
parser::Spanning,
|
||||||
use crate::schema::model::DirectiveType;
|
schema::{meta::Field as FieldType, model::DirectiveType},
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
validation::{ValidatorContext, Visitor},
|
||||||
use crate::value::ScalarValue;
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct ProvidedNonNullArguments;
|
pub struct ProvidedNonNullArguments;
|
||||||
|
|
||||||
|
@ -98,9 +99,11 @@ fn directive_error_message(directive_name: &str, arg_name: &str, type_name: &str
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{directive_error_message, factory, field_error_message};
|
use super::{directive_error_message, factory, field_error_message};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ignores_unknown_arguments() {
|
fn ignores_unknown_arguments() {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::ast::Field;
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::Field,
|
||||||
use crate::validation::{RuleError, ValidatorContext, Visitor};
|
parser::Spanning,
|
||||||
use crate::value::ScalarValue;
|
validation::{RuleError, ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct ScalarLeafs;
|
pub struct ScalarLeafs;
|
||||||
|
|
||||||
|
@ -57,9 +59,11 @@ fn required_error_message(field_name: &str, type_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{factory, no_allowed_error_message, required_error_message};
|
use super::{factory, no_allowed_error_message, required_error_message};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn valid_scalar_selection() {
|
fn valid_scalar_selection() {
|
||||||
|
@ -196,5 +200,4 @@ mod tests {
|
||||||
)],
|
)],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use std::collections::hash_map::{Entry, HashMap};
|
use std::collections::hash_map::{Entry, HashMap};
|
||||||
|
|
||||||
use crate::ast::{Directive, Field, InputValue};
|
use crate::{
|
||||||
use crate::parser::{SourcePosition, Spanning};
|
ast::{Directive, Field, InputValue},
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
parser::{SourcePosition, Spanning},
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct UniqueArgumentNames<'a> {
|
pub struct UniqueArgumentNames<'a> {
|
||||||
known_names: HashMap<&'a str, SourcePosition>,
|
known_names: HashMap<&'a str, SourcePosition>,
|
||||||
|
@ -54,9 +56,11 @@ fn error_message(arg_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_arguments_on_field() {
|
fn no_arguments_on_field() {
|
||||||
|
@ -260,5 +264,4 @@ mod tests {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use std::collections::hash_map::{Entry, HashMap};
|
use std::collections::hash_map::{Entry, HashMap};
|
||||||
|
|
||||||
use crate::ast::Fragment;
|
use crate::{
|
||||||
use crate::parser::{SourcePosition, Spanning};
|
ast::Fragment,
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
parser::{SourcePosition, Spanning},
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct UniqueFragmentNames<'a> {
|
pub struct UniqueFragmentNames<'a> {
|
||||||
names: HashMap<&'a str, SourcePosition>,
|
names: HashMap<&'a str, SourcePosition>,
|
||||||
|
@ -46,9 +48,11 @@ fn duplicate_message(frag_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{duplicate_message, factory};
|
use super::{duplicate_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_fragments() {
|
fn no_fragments() {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use std::collections::hash_map::{Entry, HashMap};
|
use std::collections::hash_map::{Entry, HashMap};
|
||||||
|
|
||||||
use crate::ast::InputValue;
|
use crate::{
|
||||||
use crate::parser::{SourcePosition, Spanning};
|
ast::InputValue,
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
parser::{SourcePosition, Spanning},
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct UniqueInputFieldNames<'a> {
|
pub struct UniqueInputFieldNames<'a> {
|
||||||
known_name_stack: Vec<HashMap<&'a str, SourcePosition>>,
|
known_name_stack: Vec<HashMap<&'a str, SourcePosition>>,
|
||||||
|
@ -64,9 +66,11 @@ fn error_message(field_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn input_object_with_fields() {
|
fn input_object_with_fields() {
|
||||||
|
@ -170,5 +174,4 @@ mod tests {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use std::collections::hash_map::{Entry, HashMap};
|
use std::collections::hash_map::{Entry, HashMap};
|
||||||
|
|
||||||
use crate::ast::Operation;
|
use crate::{
|
||||||
use crate::parser::{SourcePosition, Spanning};
|
ast::Operation,
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
parser::{SourcePosition, Spanning},
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct UniqueOperationNames<'a> {
|
pub struct UniqueOperationNames<'a> {
|
||||||
names: HashMap<&'a str, SourcePosition>,
|
names: HashMap<&'a str, SourcePosition>,
|
||||||
|
@ -45,9 +47,11 @@ fn error_message(op_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_operations() {
|
fn no_operations() {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use std::collections::hash_map::{Entry, HashMap};
|
use std::collections::hash_map::{Entry, HashMap};
|
||||||
|
|
||||||
use crate::ast::{Operation, VariableDefinition};
|
use crate::{
|
||||||
use crate::parser::{SourcePosition, Spanning};
|
ast::{Operation, VariableDefinition},
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
parser::{SourcePosition, Spanning},
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct UniqueVariableNames<'a> {
|
pub struct UniqueVariableNames<'a> {
|
||||||
names: HashMap<&'a str, SourcePosition>,
|
names: HashMap<&'a str, SourcePosition>,
|
||||||
|
@ -54,9 +56,11 @@ fn error_message(var_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn unique_variable_names() {
|
fn unique_variable_names() {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::ast::VariableDefinition;
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::VariableDefinition,
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
parser::Spanning,
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct UniqueVariableNames;
|
pub struct UniqueVariableNames;
|
||||||
|
|
||||||
|
@ -43,9 +45,11 @@ fn error_message(var_name: &str, type_name: &str) -> String {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn input_types_are_valid() {
|
fn input_types_are_valid() {
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
use std::borrow::Cow;
|
use std::{
|
||||||
use std::collections::{HashMap, HashSet};
|
borrow::Cow,
|
||||||
use std::fmt::Debug;
|
collections::{HashMap, HashSet},
|
||||||
|
fmt::Debug,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::ast::{Document, Fragment, FragmentSpread, Operation, Type, VariableDefinition};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::{Document, Fragment, FragmentSpread, Operation, Type, VariableDefinition},
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
parser::Spanning,
|
||||||
use crate::value::ScalarValue;
|
validation::{ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum Scope<'a> {
|
pub enum Scope<'a> {
|
||||||
|
@ -161,9 +165,11 @@ fn error_message(var_name: &str, type_name: &str, expected_type_name: &str) -> S
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{error_message, factory};
|
use super::{error_message, factory};
|
||||||
|
|
||||||
use crate::parser::SourcePosition;
|
use crate::{
|
||||||
use crate::validation::{expect_fails_rule, expect_passes_rule, RuleError};
|
parser::SourcePosition,
|
||||||
use crate::value::DefaultScalarValue;
|
validation::{expect_fails_rule, expect_passes_rule, RuleError},
|
||||||
|
value::DefaultScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn boolean_into_boolean() {
|
fn boolean_into_boolean() {
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
use juniper_codegen::GraphQLInputObjectInternal as GraphQLInputObject;
|
use juniper_codegen::GraphQLInputObjectInternal as GraphQLInputObject;
|
||||||
|
|
||||||
use crate::ast::{FromInputValue, InputValue};
|
use crate::{
|
||||||
use crate::executor::Registry;
|
ast::{FromInputValue, InputValue},
|
||||||
use crate::parser::parse_document_source;
|
executor::Registry,
|
||||||
use crate::schema::meta::{EnumValue, MetaType};
|
parser::parse_document_source,
|
||||||
use crate::schema::model::{DirectiveLocation, DirectiveType, RootNode};
|
schema::{
|
||||||
use crate::types::base::GraphQLType;
|
meta::{EnumValue, MetaType},
|
||||||
use crate::types::scalars::ID;
|
model::{DirectiveLocation, DirectiveType, RootNode},
|
||||||
use crate::validation::{visit, MultiVisitorNil, RuleError, ValidatorContext, Visitor};
|
},
|
||||||
use crate::value::{ScalarRefValue, ScalarValue};
|
types::{base::GraphQLType, scalars::ID},
|
||||||
|
validation::{visit, MultiVisitorNil, RuleError, ValidatorContext, Visitor},
|
||||||
|
value::{ScalarRefValue, ScalarValue},
|
||||||
|
};
|
||||||
|
|
||||||
struct Being;
|
struct Being;
|
||||||
struct Pet;
|
struct Pet;
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
use crate::ast::{
|
use crate::{
|
||||||
Directive, Document, Field, Fragment, FragmentSpread, InlineFragment, InputValue, Operation,
|
ast::{
|
||||||
Selection, VariableDefinition,
|
Directive, Document, Field, Fragment, FragmentSpread, InlineFragment, InputValue,
|
||||||
|
Operation, Selection, VariableDefinition,
|
||||||
|
},
|
||||||
|
parser::Spanning,
|
||||||
|
validation::ValidatorContext,
|
||||||
|
value::ScalarValue,
|
||||||
};
|
};
|
||||||
use crate::parser::Spanning;
|
|
||||||
use crate::validation::ValidatorContext;
|
|
||||||
use crate::value::ScalarValue;
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub trait Visitor<'a, S>
|
pub trait Visitor<'a, S>
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use crate::ast::{
|
use crate::{
|
||||||
Arguments, Definition, Directive, Document, Field, Fragment, FragmentSpread, InlineFragment,
|
ast::{
|
||||||
InputValue, Operation, OperationType, Selection, Type, VariableDefinitions,
|
Arguments, Definition, Directive, Document, Field, Fragment, FragmentSpread,
|
||||||
|
InlineFragment, InputValue, Operation, OperationType, Selection, Type, VariableDefinitions,
|
||||||
|
},
|
||||||
|
parser::Spanning,
|
||||||
|
schema::meta::Argument,
|
||||||
|
validation::{multi_visitor::MultiVisitorCons, ValidatorContext, Visitor},
|
||||||
|
value::ScalarValue,
|
||||||
};
|
};
|
||||||
use crate::parser::Spanning;
|
|
||||||
use crate::schema::meta::Argument;
|
|
||||||
use crate::validation::multi_visitor::MultiVisitorCons;
|
|
||||||
use crate::validation::{ValidatorContext, Visitor};
|
|
||||||
use crate::value::ScalarValue;
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn visit<'a, A, B, S>(
|
pub fn visit<'a, A, B, S>(
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
use crate::ast::{InputValue, ToInputValue};
|
use crate::{
|
||||||
use crate::parser::Spanning;
|
ast::{InputValue, ToInputValue},
|
||||||
|
parser::Spanning,
|
||||||
|
};
|
||||||
mod object;
|
mod object;
|
||||||
mod scalar;
|
mod scalar;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use std::iter::FromIterator;
|
use std::{iter::FromIterator, vec::IntoIter};
|
||||||
use std::vec::IntoIter;
|
|
||||||
|
|
||||||
use super::Value;
|
use super::Value;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use crate::parser::{ParseError, ScalarToken};
|
use crate::parser::{ParseError, ScalarToken};
|
||||||
use juniper_codegen::GraphQLScalarValueInternal as GraphQLScalarValue;
|
use juniper_codegen::GraphQLScalarValueInternal as GraphQLScalarValue;
|
||||||
use serde::de;
|
use serde::{de, ser::Serialize};
|
||||||
use serde::ser::Serialize;
|
|
||||||
use std::fmt::{self, Debug, Display};
|
use std::fmt::{self, Debug, Display};
|
||||||
|
|
||||||
/// The result of converting a string into a scalar value
|
/// The result of converting a string into a scalar value
|
||||||
|
|
|
@ -5,14 +5,15 @@ extern crate juniper_hyper;
|
||||||
extern crate pretty_env_logger;
|
extern crate pretty_env_logger;
|
||||||
|
|
||||||
use futures::future;
|
use futures::future;
|
||||||
use hyper::rt::{self, Future};
|
use hyper::{
|
||||||
use hyper::service::service_fn;
|
rt::{self, Future},
|
||||||
use hyper::Method;
|
service::service_fn,
|
||||||
use hyper::{Body, Response, Server, StatusCode};
|
Body, Method, Response, Server, StatusCode,
|
||||||
use juniper::tests::model::Database;
|
};
|
||||||
use juniper::tests::schema::Query;
|
use juniper::{
|
||||||
use juniper::EmptyMutation;
|
tests::{model::Database, schema::Query},
|
||||||
use juniper::RootNode;
|
EmptyMutation, RootNode,
|
||||||
|
};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -4,17 +4,17 @@
|
||||||
extern crate reqwest;
|
extern crate reqwest;
|
||||||
|
|
||||||
use futures::future::Either;
|
use futures::future::Either;
|
||||||
use hyper::header::HeaderValue;
|
use hyper::{
|
||||||
use hyper::rt::Stream;
|
header::{self, HeaderValue},
|
||||||
use hyper::{header, Body, Method, Request, Response, StatusCode};
|
rt::Stream,
|
||||||
use juniper::http::GraphQLRequest as JuniperGraphQLRequest;
|
Body, Method, Request, Response, StatusCode,
|
||||||
use juniper::serde::Deserialize;
|
};
|
||||||
use juniper::{DefaultScalarValue, GraphQLType, InputValue, RootNode, ScalarRefValue, ScalarValue};
|
use juniper::{
|
||||||
|
http::GraphQLRequest as JuniperGraphQLRequest, serde::Deserialize, DefaultScalarValue,
|
||||||
|
GraphQLType, InputValue, RootNode, ScalarRefValue, ScalarValue,
|
||||||
|
};
|
||||||
use serde_json::error::Error as SerdeError;
|
use serde_json::error::Error as SerdeError;
|
||||||
use std::error::Error;
|
use std::{error::Error, fmt, string::FromUtf8Error, sync::Arc};
|
||||||
use std::fmt;
|
|
||||||
use std::string::FromUtf8Error;
|
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::prelude::*;
|
use tokio::prelude::*;
|
||||||
use url::form_urlencoded;
|
use url::form_urlencoded;
|
||||||
|
|
||||||
|
@ -307,20 +307,18 @@ impl Error for GraphQLRequestError {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use futures::{future, future::Either, Future};
|
use futures::{
|
||||||
use hyper::service::service_fn;
|
future::{self, Either},
|
||||||
use hyper::Method;
|
Future,
|
||||||
use hyper::{Body, Response, Server, StatusCode};
|
};
|
||||||
use juniper::http::tests as http_tests;
|
use hyper::{service::service_fn, Body, Method, Response, Server, StatusCode};
|
||||||
use juniper::tests::model::Database;
|
use juniper::{
|
||||||
use juniper::tests::schema::Query;
|
http::tests as http_tests,
|
||||||
use juniper::EmptyMutation;
|
tests::{model::Database, schema::Query},
|
||||||
use juniper::RootNode;
|
EmptyMutation, RootNode,
|
||||||
use reqwest;
|
};
|
||||||
use reqwest::Response as ReqwestResponse;
|
use reqwest::{self, Response as ReqwestResponse};
|
||||||
use std::sync::Arc;
|
use std::{sync::Arc, thread, time};
|
||||||
use std::thread;
|
|
||||||
use std::time;
|
|
||||||
use tokio::runtime::Runtime;
|
use tokio::runtime::Runtime;
|
||||||
|
|
||||||
struct TestHyperIntegration;
|
struct TestHyperIntegration;
|
||||||
|
|
|
@ -8,9 +8,10 @@ extern crate serde;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
use iron::prelude::*;
|
use iron::prelude::*;
|
||||||
use juniper::tests::model::Database;
|
use juniper::{
|
||||||
use juniper::tests::schema::Query;
|
tests::{model::Database, schema::Query},
|
||||||
use juniper::EmptyMutation;
|
EmptyMutation,
|
||||||
|
};
|
||||||
use juniper_iron::{GraphQLHandler, GraphiQLHandler};
|
use juniper_iron::{GraphQLHandler, GraphiQLHandler};
|
||||||
use logger::Logger;
|
use logger::Logger;
|
||||||
use mount::Mount;
|
use mount::Mount;
|
||||||
|
|
|
@ -110,23 +110,17 @@ extern crate iron_test;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate url;
|
extern crate url;
|
||||||
|
|
||||||
use iron::itry;
|
use iron::{itry, method, middleware::Handler, mime::Mime, prelude::*, status};
|
||||||
use iron::method;
|
|
||||||
use iron::middleware::Handler;
|
|
||||||
use iron::mime::Mime;
|
|
||||||
use iron::prelude::*;
|
|
||||||
use iron::status;
|
|
||||||
use urlencoded::{UrlDecodingError, UrlEncodedQuery};
|
use urlencoded::{UrlDecodingError, UrlEncodedQuery};
|
||||||
|
|
||||||
use std::error::Error;
|
use std::{error::Error, fmt, io::Read};
|
||||||
use std::fmt;
|
|
||||||
use std::io::Read;
|
|
||||||
|
|
||||||
use serde_json::error::Error as SerdeError;
|
use serde_json::error::Error as SerdeError;
|
||||||
|
|
||||||
use juniper::http;
|
use juniper::{
|
||||||
use juniper::serde::Deserialize;
|
http, serde::Deserialize, DefaultScalarValue, GraphQLType, InputValue, RootNode,
|
||||||
use juniper::{DefaultScalarValue, GraphQLType, InputValue, RootNode, ScalarRefValue, ScalarValue};
|
ScalarRefValue, ScalarValue,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(serde_derive::Deserialize)]
|
#[derive(serde_derive::Deserialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
|
@ -435,15 +429,15 @@ impl From<GraphQLIronError> for IronError {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use iron::Url;
|
use iron::{Handler, Headers, Url};
|
||||||
use iron::{Handler, Headers};
|
|
||||||
use iron_test::{request, response};
|
use iron_test::{request, response};
|
||||||
use url::percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET};
|
use url::percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET};
|
||||||
|
|
||||||
use juniper::http::tests as http_tests;
|
use juniper::{
|
||||||
use juniper::tests::model::Database;
|
http::tests as http_tests,
|
||||||
use juniper::tests::schema::Query;
|
tests::{model::Database, schema::Query},
|
||||||
use juniper::EmptyMutation;
|
EmptyMutation,
|
||||||
|
};
|
||||||
|
|
||||||
use super::GraphQLHandler;
|
use super::GraphQLHandler;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#![feature(decl_macro, proc_macro_hygiene)]
|
#![feature(decl_macro, proc_macro_hygiene)]
|
||||||
|
|
||||||
use rocket::response::content;
|
use rocket::{response::content, State};
|
||||||
use rocket::State;
|
|
||||||
|
|
||||||
use juniper::tests::model::Database;
|
use juniper::{
|
||||||
use juniper::tests::schema::Query;
|
tests::{model::Database, schema::Query},
|
||||||
use juniper::{EmptyMutation, RootNode};
|
EmptyMutation, RootNode,
|
||||||
|
};
|
||||||
|
|
||||||
type Schema = RootNode<'static, Query, EmptyMutation<Database>>;
|
type Schema = RootNode<'static, Query, EmptyMutation<Database>>;
|
||||||
|
|
||||||
|
|
|
@ -39,27 +39,27 @@ Check the LICENSE file for details.
|
||||||
#![doc(html_root_url = "https://docs.rs/juniper_rocket/0.2.0")]
|
#![doc(html_root_url = "https://docs.rs/juniper_rocket/0.2.0")]
|
||||||
#![feature(decl_macro, proc_macro_hygiene)]
|
#![feature(decl_macro, proc_macro_hygiene)]
|
||||||
|
|
||||||
use std::error::Error;
|
use std::{
|
||||||
use std::io::{Cursor, Read};
|
error::Error,
|
||||||
|
io::{Cursor, Read},
|
||||||
|
};
|
||||||
|
|
||||||
use rocket::data::{FromDataSimple, Outcome as FromDataOutcome};
|
use rocket::{
|
||||||
use rocket::http::{ContentType, RawStr, Status};
|
data::{FromDataSimple, Outcome as FromDataOutcome},
|
||||||
use rocket::request::{FormItems, FromForm, FromFormValue};
|
http::{ContentType, RawStr, Status},
|
||||||
use rocket::response::{content, Responder, Response};
|
request::{FormItems, FromForm, FromFormValue},
|
||||||
use rocket::Data;
|
response::{content, Responder, Response},
|
||||||
use rocket::Outcome::{Failure, Forward, Success};
|
Data,
|
||||||
use rocket::Request;
|
Outcome::{Failure, Forward, Success},
|
||||||
|
Request,
|
||||||
|
};
|
||||||
|
|
||||||
use juniper::http;
|
use juniper::{http, InputValue};
|
||||||
use juniper::InputValue;
|
|
||||||
|
|
||||||
use juniper::serde::Deserialize;
|
use juniper::{
|
||||||
use juniper::DefaultScalarValue;
|
serde::Deserialize, DefaultScalarValue, FieldError, GraphQLType, RootNode, ScalarRefValue,
|
||||||
use juniper::FieldError;
|
ScalarValue,
|
||||||
use juniper::GraphQLType;
|
};
|
||||||
use juniper::RootNode;
|
|
||||||
use juniper::ScalarRefValue;
|
|
||||||
use juniper::ScalarValue;
|
|
||||||
|
|
||||||
#[derive(Debug, serde_derive::Deserialize, PartialEq)]
|
#[derive(Debug, serde_derive::Deserialize, PartialEq)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
|
@ -479,18 +479,20 @@ mod fromform_tests {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use rocket::http::ContentType;
|
use rocket::{
|
||||||
use rocket::local::{Client, LocalRequest};
|
self, get,
|
||||||
use rocket::request::Form;
|
http::ContentType,
|
||||||
use rocket::Rocket;
|
local::{Client, LocalRequest},
|
||||||
use rocket::State;
|
post,
|
||||||
use rocket::{self, get, post, routes};
|
request::Form,
|
||||||
|
routes, Rocket, State,
|
||||||
|
};
|
||||||
|
|
||||||
use juniper::http::tests as http_tests;
|
use juniper::{
|
||||||
use juniper::tests::model::Database;
|
http::tests as http_tests,
|
||||||
use juniper::tests::schema::Query;
|
tests::{model::Database, schema::Query},
|
||||||
use juniper::EmptyMutation;
|
EmptyMutation, RootNode,
|
||||||
use juniper::RootNode;
|
};
|
||||||
|
|
||||||
type Schema = RootNode<'static, Query, EmptyMutation<Database>>;
|
type Schema = RootNode<'static, Query, EmptyMutation<Database>>;
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
|
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
use juniper::tests::model::Database;
|
use juniper::{
|
||||||
use juniper::tests::schema::Query;
|
tests::{model::Database, schema::Query},
|
||||||
use juniper::{EmptyMutation, RootNode};
|
EmptyMutation, RootNode,
|
||||||
|
};
|
||||||
use warp::{http::Response, Filter};
|
use warp::{http::Response, Filter};
|
||||||
|
|
||||||
type Schema = RootNode<'static, Query, EmptyMutation<Database>>;
|
type Schema = RootNode<'static, Query, EmptyMutation<Database>>;
|
||||||
|
|
|
@ -308,8 +308,7 @@ fn playground_response(graphql_endpoint_url: &'static str) -> warp::http::Respon
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use warp::http;
|
use warp::{http, test::request};
|
||||||
use warp::test::request;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn graphiql_response_does_not_panic() {
|
fn graphiql_response_does_not_panic() {
|
||||||
|
@ -390,9 +389,10 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn graphql_handler_works_json_post() {
|
fn graphql_handler_works_json_post() {
|
||||||
use juniper::tests::model::Database;
|
use juniper::{
|
||||||
use juniper::tests::schema::Query;
|
tests::{model::Database, schema::Query},
|
||||||
use juniper::{EmptyMutation, RootNode};
|
EmptyMutation, RootNode,
|
||||||
|
};
|
||||||
|
|
||||||
type Schema = juniper::RootNode<'static, Query, EmptyMutation<Database>>;
|
type Schema = juniper::RootNode<'static, Query, EmptyMutation<Database>>;
|
||||||
|
|
||||||
|
@ -422,9 +422,10 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn batch_requests_work() {
|
fn batch_requests_work() {
|
||||||
use juniper::tests::model::Database;
|
use juniper::{
|
||||||
use juniper::tests::schema::Query;
|
tests::{model::Database, schema::Query},
|
||||||
use juniper::{EmptyMutation, RootNode};
|
EmptyMutation, RootNode,
|
||||||
|
};
|
||||||
|
|
||||||
type Schema = juniper::RootNode<'static, Query, EmptyMutation<Database>>;
|
type Schema = juniper::RootNode<'static, Query, EmptyMutation<Database>>;
|
||||||
|
|
||||||
|
@ -469,13 +470,12 @@ mod tests {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests_http_harness {
|
mod tests_http_harness {
|
||||||
use super::*;
|
use super::*;
|
||||||
use juniper::http::tests::{run_http_test_suite, HTTPIntegration, TestResponse};
|
use juniper::{
|
||||||
use juniper::tests::model::Database;
|
http::tests::{run_http_test_suite, HTTPIntegration, TestResponse},
|
||||||
use juniper::tests::schema::Query;
|
tests::{model::Database, schema::Query},
|
||||||
use juniper::EmptyMutation;
|
EmptyMutation, RootNode,
|
||||||
use juniper::RootNode;
|
};
|
||||||
use warp;
|
use warp::{self, Filter};
|
||||||
use warp::Filter;
|
|
||||||
|
|
||||||
type Schema = juniper::RootNode<'static, Query, EmptyMutation<Database>>;
|
type Schema = juniper::RootNode<'static, Query, EmptyMutation<Database>>;
|
||||||
|
|
||||||
|
|
1
rustfmt.toml
Normal file
1
rustfmt.toml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
merge_imports = true
|
Loading…
Reference in a new issue