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.
This commit is contained in:
Sebastian Thiel
2015-08-08 10:52:23 +02:00
parent 62b63b251a
commit 8ab4fd0bd4
9 changed files with 36 additions and 16 deletions

View File

@@ -1,3 +1,20 @@
<a name="cli-v0.3.2:cli-v0.1.9"></a>
## 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))
<a name="cli-v0.3.1"></a>
## cli-v0.3.1 (2015-06-26)

View File

@@ -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:

View File

@@ -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:

View File

@@ -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}

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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() {

View File

@@ -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;