From 8ab4fd0bd4b64eb76c77adc82aff99df17a1070c Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 8 Aug 2015 10:52:23 +0200 Subject: [PATCH] fix(serde-up): update to serde 0.5.0 Serde move all json code into a separate crate that we are now using as well. --- changelog.md | 17 +++++++++++++++++ etc/api/type-api.yaml | 2 +- etc/api/type-cli.yaml | 2 +- src/mako/Cargo.toml.mako | 7 ++++--- src/mako/api/lib.rs.in.mako | 3 ++- src/mako/cli/lib/engine.mako | 2 +- src/mako/cli/main.rs.mako | 1 + src/rust/api/cmn.rs | 14 +++++++------- src/rust/cli/cmn.rs | 4 ++-- 9 files changed, 36 insertions(+), 16 deletions(-) diff --git a/changelog.md b/changelog.md index 4ad390a73c..6a694d7c3a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,20 @@ + +## cli-v0.3.2:cli-v0.1.9 (2015-08-08) + + +#### Bug Fixes + +* **clap-up** use clap 1.0.3 ([be894bec](https://github.com/Byron/google-apis-rs/commit/be894becc38296a62760a0724ea1310081e713de)) +* **deploy** adjust linux script to target dir ([0f61fa4c](https://github.com/Byron/google-apis-rs/commit/0f61fa4c95c25c0e9f30cc10b6aa3b005d26e3ca)) +* **hyper-up** compatibility with hyper 0.6.4 ([e129a7d3](https://github.com/Byron/google-apis-rs/commit/e129a7d3ae878a9ee78ea21fe1c0aa8b5671a5e0), closes [#123](https://github.com/Byron/google-apis-rs/issues/123)) +* **serde-up** update to serde 0.5.0 ([2d574591](https://github.com/Byron/google-apis-rs/commit/2d574591365c4a289d1b06464da94c46a51d0037)) + +#### Improvements + +* **cli** pretty-print errors in debug mode ([152cdd84](https://github.com/Byron/google-apis-rs/commit/152cdd848a41109819d890560d26270bd08c12ae)) + + + ## cli-v0.3.1 (2015-06-26) diff --git a/etc/api/type-api.yaml b/etc/api/type-api.yaml index 6f1847fcb6..b1c9c195a3 100644 --- a/etc/api/type-api.yaml +++ b/etc/api/type-api.yaml @@ -25,7 +25,7 @@ make: - source: build.rs output_dir: src cargo: - build_version: "0.1.8" + build_version: "0.1.9" build_script: src/build.rs keywords: [protocol, web, api] dependencies: diff --git a/etc/api/type-cli.yaml b/etc/api/type-cli.yaml index cd0a5fbccf..ec86be019d 100644 --- a/etc/api/type-cli.yaml +++ b/etc/api/type-cli.yaml @@ -22,7 +22,7 @@ make: - source: main.rs output_dir: src cargo: - build_version: "0.3.1" + build_version: "0.3.2" keywords: [cli] is_executable: YES dependencies: diff --git a/src/mako/Cargo.toml.mako b/src/mako/Cargo.toml.mako index c5339a239b..1b2a071ccc 100644 --- a/src/mako/Cargo.toml.mako +++ b/src/mako/Cargo.toml.mako @@ -26,10 +26,11 @@ name = "${util.program_name()}" % endif [dependencies] -hyper = ">= 0.6.4" +hyper = ">= 0.6.8" ## Must match the one hyper uses, otherwise there are duplicate similarly named `Mime` structs -mime = "0.0.12" -serde = ">= 0.4.1" +mime = "0.1.0" +serde = ">= 0.5.0" +serde_json = "*" yup-oauth2 = "*" % for dep in cargo.get('dependencies', list()): ${dep} diff --git a/src/mako/api/lib.rs.in.mako b/src/mako/api/lib.rs.in.mako index b7d6d63f1e..d2104ed209 100644 --- a/src/mako/api/lib.rs.in.mako +++ b/src/mako/api/lib.rs.in.mako @@ -21,6 +21,7 @@ extern crate hyper; extern crate serde; +extern crate serde_json; extern crate yup_oauth2 as oauth2; extern crate mime; extern crate url; @@ -32,7 +33,7 @@ use std::cell::RefCell; use std::borrow::BorrowMut; use std::default::Default; use std::collections::BTreeMap; -use serde::json; +use serde_json as json; use std::io; use std::fs; use std::thread::sleep_ms; diff --git a/src/mako/cli/lib/engine.mako b/src/mako/cli/lib/engine.mako index 1001cba784..23c7380774 100644 --- a/src/mako/cli/lib/engine.mako +++ b/src/mako/cli/lib/engine.mako @@ -39,7 +39,7 @@ use std::default::Default; use std::str::FromStr; use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; -use serde::json; +use serde_json as json; use clap::ArgMatches; enum DoitError { diff --git a/src/mako/cli/main.rs.mako b/src/mako/cli/main.rs.mako index ed3be114e3..80aaef2170 100644 --- a/src/mako/cli/main.rs.mako +++ b/src/mako/cli/main.rs.mako @@ -19,6 +19,7 @@ extern crate clap; extern crate yup_oauth2 as oauth2; extern crate yup_hyper_mock as mock; extern crate serde; +extern crate serde_json; extern crate hyper; extern crate mime; extern crate strsim; diff --git a/src/rust/api/cmn.rs b/src/rust/api/cmn.rs index d4a10abdfb..6c5f90fe2a 100644 --- a/src/rust/api/cmn.rs +++ b/src/rust/api/cmn.rs @@ -14,7 +14,7 @@ use hyper::http::h1::LINE_ENDING; use hyper::method::Method; use hyper::status::StatusCode; -use serde; +use serde_json as json; /// Identifies the Hub. There is only one per library, this trait is supposed /// to make intended use more explicit. @@ -186,7 +186,7 @@ pub trait Delegate { /// /// * `json_encoded_value` - The json-encoded value which failed to decode. /// * `json_decode_error` - The decoder error - fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &serde::json::Error) { + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { let _ = json_encoded_value; let _ = json_decode_error; } @@ -273,7 +273,7 @@ pub enum Error { /// Shows that we failed to decode the server response. /// This can happen if the protocol changes in conjunction with strict json decoding. - JsonDecodeError(String, serde::json::Error), + JsonDecodeError(String, json::Error), /// Indicates an HTTP repsonse with a non-success status code Failure(hyper::client::Response), @@ -716,8 +716,8 @@ impl<'a, A> ResumableUploadHelper<'a, A> let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let Retry::After(d) = self.delegate.http_failure(&res, - serde::json::from_str(&json_err).ok(), - serde::json::from_str(&json_err).ok()) { + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { sleep_ms(d.num_milliseconds() as u32); continue; } @@ -738,9 +738,9 @@ impl<'a, A> ResumableUploadHelper<'a, A> // Copy of src/rust/cli/cmn.rs // TODO(ST): Allow sharing common code between program types -pub fn remove_json_null_values(value: &mut serde::json::value::Value) { +pub fn remove_json_null_values(value: &mut json::value::Value) { match *value { - serde::json::value::Value::Object(ref mut map) => { + json::value::Value::Object(ref mut map) => { let mut for_removal = Vec::new(); for (key, mut value) in map.iter_mut() { diff --git a/src/rust/cli/cmn.rs b/src/rust/cli/cmn.rs index d4d131f762..743ce21931 100644 --- a/src/rust/cli/cmn.rs +++ b/src/rust/cli/cmn.rs @@ -1,6 +1,6 @@ use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; -use serde::json; -use serde::json::value::Value; +use serde_json as json; +use serde_json::value::Value; use mime::Mime; use clap::{App, SubCommand}; use strsim;