mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-08 04:21:00 +01:00
fix enum type not being wrapped as Vec if repeated
This commit is contained in:
@@ -461,10 +461,11 @@ def to_rust_type_inner(
|
||||
return wrap_type(rt)
|
||||
try:
|
||||
if is_property_enum(t):
|
||||
x = get_enum_type(schema_name, property_name)
|
||||
return wrap_type(x)
|
||||
# prefer format if present
|
||||
rust_type = RUST_TYPE_MAP[t.get("format", t["type"])]
|
||||
rust_type = get_enum_type(schema_name, property_name)
|
||||
else:
|
||||
# prefer format if present
|
||||
rust_type = RUST_TYPE_MAP[t.get("format", t["type"])]
|
||||
|
||||
if rust_type == Vec(None):
|
||||
return wrap_type(Vec(nested_type(t)))
|
||||
if rust_type == HashMap(None, None):
|
||||
|
||||
@@ -95,7 +95,7 @@ if not enum_descriptions:
|
||||
<% #print(variant_name, '=>', description)
|
||||
%>
|
||||
% if description:
|
||||
% for line in e.description.splitlines():
|
||||
% for line in description.splitlines():
|
||||
/// ${line}
|
||||
% endfor
|
||||
///
|
||||
@@ -138,7 +138,7 @@ impl<'a> Into<std::borrow::Cow<'a, str>> for &'a ${enum_type} {
|
||||
% if get_enum_default(e) is not None:
|
||||
impl Default for ${enum_type} {
|
||||
fn default() -> ${enum_type} {
|
||||
${enum_type}::${to_enum_variant_name(e.get('default'))}
|
||||
${enum_type}::${to_enum_variant_name(e.default)}
|
||||
}
|
||||
}
|
||||
% endif
|
||||
|
||||
@@ -581,7 +581,7 @@ match result {
|
||||
% endif ## not is_required_property(p)
|
||||
% endif is_repeated_property(p):
|
||||
% endif ## p.name == 'part' and request_value:
|
||||
% if p.get('repeated', False):
|
||||
% if is_repeated_property(p):
|
||||
if ${pname}.len() > 0 {
|
||||
for f in ${pname}.iter() {
|
||||
params.push("${p.name}", ${to_string_impl("f")});
|
||||
@@ -592,8 +592,10 @@ match result {
|
||||
params.push("${p.name}", ${to_string_impl("value")});
|
||||
}
|
||||
% else:
|
||||
params.push("${p.name}", &${to_string_impl(pname)});
|
||||
let param = ${to_string_impl(pname)};
|
||||
params.push("${p.name}", ¶m);
|
||||
% endif
|
||||
|
||||
% endfor
|
||||
|
||||
params.extend(${paddfields}.iter());
|
||||
|
||||
Reference in New Issue
Block a user