Repository: graphql-rust/juniper (language: rust)

Issue:
serde 1.0 support?
I'm currently working on a project with serde v1.0.7 but I'm getting compilation errors when trying to serialize an execution result.

```
the trait `serde::Serialize` is not implemented for `juniper::Value`
the trait `serde::Serialize` is not implemented for `juniper::ExecutionError`
```

Is this expected?  Possibly user error?



Discussion / hints:
It's because juniper still has serde version 0.9, which leads to the traits not being implemented for serde `1.0`.

You'll need to downgrade other dependencies that still use serde 0.9 or do a PR to upgrade juniper.

Fix patch:
diff --git a/Cargo.toml b/Cargo.toml
index da46c251f..612357f75 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,7 +24,7 @@ expose-test-schema = []
 [dependencies]
 rustc-serialize = { version = "^0.3.19", optional = true }
 iron = { version = "^0.5.1", optional = true }
-serde = { version = "^0.9.1", optional = true }
+serde = { version = "^1.0.8", optional = true }
 
 [dev-dependencies]
 iron = "^0.5.1"
diff --git a/src/integrations/serde.rs b/src/integrations/serde.rs
index e8662949b..f919bc026 100644
--- a/src/integrations/serde.rs
+++ b/src/integrations/serde.rs
@@ -49,13 +49,13 @@ impl<'a> ser::Serialize for GraphQLError<'a> {
     }
 }
 
-impl de::Deserialize for InputValue {
+impl<'de> de::Deserialize<'de> for InputValue {
     fn deserialize<D>(deserializer: D) -> Result<InputValue, D::Error>
-        where D: de::Deserializer,
+        where D: de::Deserializer<'de>,
     {
         struct InputValueVisitor;
 
-        impl de::Visitor for InputValueVisitor {
+        impl<'de> de::Visitor<'de> for InputValueVisitor {
             type Value = InputValue;
 
             fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@@ -98,23 +98,32 @@ impl de::Deserialize for InputValue {
                 Ok(InputValue::null())
             }
 
-            fn visit_seq<V>(self, visitor: V) -> Result<InputValue, V::Error>
-                where V: de::SeqVisitor,
+            fn visit_seq<V>(self, mut visitor: V) -> Result<InputValue, V::Error>
+                where V: de::SeqAccess<'de>,
             {
-                let values = try!(de::impls::VecVisitor::new().visit_seq(visitor));
+                let mut values = Vec::new();
+
+                while let Some(el) = try!(visitor.next_element()) {
+                    values.push(el);
+                }
+
                 Ok(InputValue::list(values))
             }
 
-            fn visit_map<V>(self, visitor: V) -> Result<InputValue, V::Error>
-                where V: de::MapVisitor,
+            fn visit_map<V>(self, mut visitor: V) -> Result<InputValue, V::Error>
+                where V: de::MapAccess<'de>,
             {
-                let values = try!(de::impls::HashMapVisitor::<String, InputValue, _>::new()
-                    .visit_map(visitor));
+                let mut values: HashMap<String, InputValue> = HashMap::new();
+
+                while let Some((key, value)) = try!(visitor.next_entry()) {
+                    values.insert(key, value);
+                }
+
                 Ok(InputValue::object(values))
             }
         }
 
-        deserializer.deserialize(InputValueVisitor)
+        deserializer.deserialize_any(InputValueVisitor)
     }
 }
 


Test patch: