diff --git a/etc/api/type-api.yaml b/etc/api/type-api.yaml index 5d45aa55679..7f988c0f893 100644 --- a/etc/api/type-api.yaml +++ b/etc/api/type-api.yaml @@ -27,3 +27,4 @@ cargo: - url = "*" - serde = ">= 0.3.0" - serde_macros = "*" + - json-tools = "*" diff --git a/etc/api/type-cli.yaml b/etc/api/type-cli.yaml index 783c3e74cf8..82f29a17726 100644 --- a/etc/api/type-cli.yaml +++ b/etc/api/type-cli.yaml @@ -31,4 +31,3 @@ cargo: - serde = ">= 0.3.0" - serde_macros = "*" - clap = "*" - - json-tools = "*" diff --git a/src/mako/api/lib.rs.mako b/src/mako/api/lib.rs.mako index cbdc56c5b50..b485218f395 100644 --- a/src/mako/api/lib.rs.mako +++ b/src/mako/api/lib.rs.mako @@ -37,6 +37,7 @@ extern crate serde; extern crate yup_oauth2 as oauth2; extern crate mime; extern crate url; +extern crate json_tools; mod cmn; diff --git a/src/mako/api/lib/mbuild.mako b/src/mako/api/lib/mbuild.mako index 518e9c80328..3c62bb1cb90 100644 --- a/src/mako/api/lib/mbuild.mako +++ b/src/mako/api/lib/mbuild.mako @@ -663,7 +663,18 @@ else { % if request_value: let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = io::Cursor::new(json::to_vec(&self.${property(REQUEST_VALUE_PROPERTY_NAME)})); + let mut request_value_reader = + { + let json_cache = json::to_string(&self.${property(REQUEST_VALUE_PROPERTY_NAME)}).unwrap(); + io::Cursor::new(json_tools::TokenReader::new( + json_tools::FilterTypedKeyValuePairs::new( + json_tools::Lexer::new( + json_cache.bytes(), + json_tools::BufferType::Span), + json_tools::TokenType::Null), + Some(&json_cache)).bytes().filter_map(|v|v.ok()).collect::${'>'}() + ) + }; let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); % endif