mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-02 17:42:16 +01:00
fix(json): Vec/HashMap are Optionals
That assures that we can decode partial server responses, and send partial structures as well.
This commit is contained in:
@@ -649,7 +649,7 @@ 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)}).unwrap());
|
||||
let mut request_value_reader = io::Cursor::new(json::to_vec(&self.${property(REQUEST_VALUE_PROPERTY_NAME)}));
|
||||
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||
% endif
|
||||
|
||||
@@ -320,10 +320,10 @@ def to_rust_type(schemas, sn, pn, t, allow_optionals=True):
|
||||
try:
|
||||
rust_type = TYPE_MAP[t.type]
|
||||
if t.type == 'array':
|
||||
return "%s<%s>" % (rust_type, unique_type_name((nested_type(t))))
|
||||
return wrap_type("%s<%s>" % (rust_type, unique_type_name((nested_type(t)))))
|
||||
elif t.type == 'object':
|
||||
if _is_map_prop(t):
|
||||
return "%s<String, %s>" % (rust_type, nested_type(t))
|
||||
return wrap_type("%s<String, %s>" % (rust_type, nested_type(t)))
|
||||
else:
|
||||
return wrap_type(nested_type(t))
|
||||
elif t.type == 'string' and 'Count' in pn:
|
||||
|
||||
Reference in New Issue
Block a user