Skip to content

Commit

Permalink
fix: avoid generating nested currency options
Browse files Browse the repository at this point in the history
  • Loading branch information
augustoccesar committed Jan 16, 2024
1 parent 8d799cd commit f020df4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions openapi/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,11 @@ pub fn gen_field_rust_type<T: Borrow<Schema>>(
// currency_options field is represented by an optional HashMap<String, T>, where the String is the currency code in ISO 4217 format.
if field_name == "currency_options" {
state.use_params.insert("CurrencyMap");

if ty.contains("CurrencyMap<") {
return ty;
}

return format!("Option<CurrencyMap<{}>>", ty);
}

Expand Down
2 changes: 1 addition & 1 deletion src/resources/generated/price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ pub struct UpdatePrice<'a> {
///
/// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
#[serde(skip_serializing_if = "Option::is_none")]
pub currency_options: Option<CurrencyMap<Option<CurrencyMap<UpdatePriceCurrencyOptions>>>>,
pub currency_options: Option<CurrencyMap<UpdatePriceCurrencyOptions>>,

/// Specifies which fields in the response should be expanded.
#[serde(skip_serializing_if = "Expand::is_empty")]
Expand Down

0 comments on commit f020df4

Please sign in to comment.