diff --git a/progenitor-client/src/progenitor_client.rs b/progenitor-client/src/progenitor_client.rs index 8baf3b87..1b92a3e9 100644 --- a/progenitor-client/src/progenitor_client.rs +++ b/progenitor-client/src/progenitor_client.rs @@ -432,7 +432,7 @@ impl RequestBuilderExt for RequestBuilder { self, iter: I, ) -> Result> { - use reqwest::multipart::{Form}; + use reqwest::multipart::Form; let mut form = Form::new(); for (name, value) in iter { diff --git a/progenitor-impl/src/cli.rs b/progenitor-impl/src/cli.rs index f7d265d4..a53558f6 100644 --- a/progenitor-impl/src/cli.rs +++ b/progenitor-impl/src/cli.rs @@ -315,19 +315,19 @@ impl Generator { OperationParameterKind::Body(_) => unreachable!(), }; - let OperationParameterType::Type(arg_type_id) = ¶m.typ else { + let OperationParameterType::Type(arg_type_id) = ¶m.typ + else { panic!() }; let arg_type = self.type_space.get_type(arg_type_id).unwrap(); let arg_details = arg_type.details(); - let arg_type_name = match &arg_details{ + let arg_type_name = match &arg_details { typify::TypeDetails::Option(opt_id) => { - let inner_type = self.type_space.get_type(opt_id).unwrap(); + let inner_type = + self.type_space.get_type(opt_id).unwrap(); inner_type.ident() } - _ => { - arg_type.ident() - } + _ => arg_type.ident(), }; let help = param.description.as_ref().map(|description| { @@ -410,21 +410,21 @@ impl Generator { let arg_name = param.name.to_kebab_case(); let arg_fn_name = sanitize(¶m.name, Case::Snake); let arg_fn = format_ident!("{}", arg_fn_name); - let OperationParameterType::Type(arg_type_id) = ¶m.typ else { + let OperationParameterType::Type(arg_type_id) = ¶m.typ + else { panic!() }; let arg_type = self.type_space.get_type(arg_type_id).unwrap(); // TODO this really should be simpler. let arg_details = arg_type.details(); - let arg_type_name = match &arg_details{ + let arg_type_name = match &arg_details { typify::TypeDetails::Option(opt_id) => { - let inner_type = self.type_space.get_type(opt_id).unwrap(); + let inner_type = + self.type_space.get_type(opt_id).unwrap(); inner_type.ident() } - _ => { - arg_type.ident() - } + _ => arg_type.ident(), }; quote! { diff --git a/progenitor-impl/src/lib.rs b/progenitor-impl/src/lib.rs index cb0406af..66a04201 100644 --- a/progenitor-impl/src/lib.rs +++ b/progenitor-impl/src/lib.rs @@ -2,8 +2,8 @@ use std::collections::{HashMap, HashSet}; -use openapiv3::OpenAPI; use indexmap::IndexSet; +use openapiv3::OpenAPI; use proc_macro2::TokenStream; use quote::quote; use serde::Deserialize; diff --git a/progenitor-impl/src/method.rs b/progenitor-impl/src/method.rs index 42862745..ee9e3f0c 100644 --- a/progenitor-impl/src/method.rs +++ b/progenitor-impl/src/method.rs @@ -1291,7 +1291,7 @@ impl Generator { typify::TypeDetails::Array(item, _) => { Some(DropshotPagination { item }) } - _ => None + _ => None, } } diff --git a/progenitor-impl/src/template.rs b/progenitor-impl/src/template.rs index 4049f5fe..85d2dc3e 100644 --- a/progenitor-impl/src/template.rs +++ b/progenitor-impl/src/template.rs @@ -37,9 +37,10 @@ impl PathTemplate { if let Component::Parameter(n) = &component { let param = format_ident!( "{}", - rename - .get(&n) - .unwrap_or_else(|| panic!("missing path name mapping {}", n)), + rename.get(&n).unwrap_or_else(|| panic!( + "missing path name mapping {}", + n + )), ); Some(quote! { encode_path(&#param.to_string()) diff --git a/progenitor-macro/src/lib.rs b/progenitor-macro/src/lib.rs index 247e2c76..f4517115 100644 --- a/progenitor-macro/src/lib.rs +++ b/progenitor-macro/src/lib.rs @@ -269,11 +269,21 @@ fn do_generate_api(item: TokenStream) -> Result { // Force a rebuild when the given file is modified. const _: &str = include_str!(#path_str); + }; - let output = expander::Expander::new(format!("{}", std::path::PathBuf::from(spec.value()).file_name().unwrap().to_string_lossy())) - .fmt(expander::Edition::_2021) - .verbose(true) - .write_to_out_dir(output).expect("Writing file works. qed"); + println!("cargo::rerun-if-changed={}", path_str); + + let output = expander::Expander::new(format!( + "{}", + std::path::PathBuf::from(spec.value()) + .file_name() + .unwrap() + .to_string_lossy() + )) + .fmt(expander::Edition::_2021) + .verbose(true) + .write_to_out_dir(output) + .expect("Writing file works. qed"); Ok(output.into()) }