diff --git a/qbittorrent-web-api-gen/src/generate/group/method/return_type.rs b/qbittorrent-web-api-gen/src/generate/group/method/return_type.rs index 4fc68f5..a4a171a 100644 --- a/qbittorrent-web-api-gen/src/generate/group/method/return_type.rs +++ b/qbittorrent-web-api-gen/src/generate/group/method/return_type.rs @@ -118,7 +118,7 @@ fn generate_builder_field( None => parameter.return_type.to_owned_type(), }; let rtype = util::to_ident(&enum_name); - let rtype_as_quote = if parameter.return_type.get_type_info().is_list { + let rtype_as_quote = if parameter.return_type.is_list() { quote! { std::vec::Vec<#rtype> } } else { quote! { #rtype } diff --git a/qbittorrent-web-api-gen/src/types.rs b/qbittorrent-web-api-gen/src/types.rs index bf4deca..722c5f9 100644 --- a/qbittorrent-web-api-gen/src/types.rs +++ b/qbittorrent-web-api-gen/src/types.rs @@ -15,7 +15,7 @@ pub struct TypeDescription { pub struct TypeInfo { pub name: String, pub is_optional: bool, - pub is_list: bool, + is_list: bool, pub description: Option, pub type_description: Option, } @@ -63,6 +63,10 @@ impl Type { } } + pub fn is_list(&self) -> bool { + self.get_type_info().is_list || matches!(self, Type::StringArray(_)) + } + pub fn to_borrowed_type(&self) -> String { match self { Type::Number(_) => "i32".into(),