diff --git a/Cargo.toml b/Cargo.toml index 0a000250a..4bed7d14f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -134,7 +134,7 @@ serde_qs = "0.10.1" serde_path_to_error = "0.1.8" smol_str = "0.1" surf = { version = "2.1", optional = true } -tokio = { version = "1.2", optional = true } +tokio = { version = "1", optional = true } smart-default = "0.6.0" uuid = { version = "0.8", optional=true, features=["v4"] } @@ -156,6 +156,12 @@ axum = { version = "0.6.18", features = ["macros"] } async-trait = "0.1" actix-web = "4.2.1" +# MSRV PINS +# +# We have a few deps that have MSRVs that are higher than our own. +# We pin them here to ensure that we can run tests on the MSRV +bumpalo = ">=3.0.0, <= 3.15.0" + [[example]] name = "checkout" required-features = ["async"] diff --git a/examples/checkout.rs b/examples/checkout.rs index 9e507b721..e929575c6 100644 --- a/examples/checkout.rs +++ b/examples/checkout.rs @@ -87,17 +87,18 @@ async fn main() { CheckoutSession::create(&client, params).await.unwrap() }; + let line_items = checkout_session.line_items.unwrap(); + println!( "created a {} checkout session for {} {:?} for {} {} at {}", checkout_session.payment_status, - checkout_session.line_items.data[0].quantity.unwrap(), - match checkout_session.line_items.data[0].price.as_ref().unwrap().product.as_ref().unwrap() - { + line_items.data[0].quantity.unwrap(), + match line_items.data[0].price.as_ref().unwrap().product.as_ref().unwrap() { Expandable::Object(p) => p.name.as_ref().unwrap(), _ => panic!("product not found"), }, checkout_session.amount_subtotal.unwrap() / 100, - checkout_session.line_items.data[0].price.as_ref().unwrap().currency.unwrap(), + line_items.data[0].price.as_ref().unwrap().currency.unwrap(), checkout_session.url.unwrap() ); } diff --git a/openapi/src/codegen.rs b/openapi/src/codegen.rs index 12cf4eb72..4b1f85ac1 100644 --- a/openapi/src/codegen.rs +++ b/openapi/src/codegen.rs @@ -1299,10 +1299,6 @@ pub fn gen_field_rust_type>( // Not sure why this is here, but we want to preserve it for now return "bool".into(); } - if ty.contains("List<") { - // N.B. return immediately; we use `Default` for list rather than `Option` - return ty; - } // currency_options field is represented by an optional HashMap, where the String is the currency code in ISO 4217 format. if field_name == "currency_options" { diff --git a/src/resources/generated/account.rs b/src/resources/generated/account.rs index 9c4494703..54178eda9 100644 --- a/src/resources/generated/account.rs +++ b/src/resources/generated/account.rs @@ -80,8 +80,8 @@ pub struct Account { /// External accounts (bank accounts and debit cards) currently attached to this account. /// /// External accounts are only returned for requests where `controller[is_controller]` is true. - #[serde(default)] - pub external_accounts: List, + #[serde(skip_serializing_if = "Option::is_none")] + pub external_accounts: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub future_requirements: Option, diff --git a/src/resources/generated/charge.rs b/src/resources/generated/charge.rs index 8bed4112f..2a627f6d2 100644 --- a/src/resources/generated/charge.rs +++ b/src/resources/generated/charge.rs @@ -158,7 +158,7 @@ pub struct Charge { pub refunded: bool, /// A list of refunds that have been applied to the charge. - pub refunds: List, + pub refunds: Option>, /// ID of the review associated with this charge if one exists. pub review: Option>, diff --git a/src/resources/generated/checkout_session.rs b/src/resources/generated/checkout_session.rs index 67d8e6bf1..b0988c132 100644 --- a/src/resources/generated/checkout_session.rs +++ b/src/resources/generated/checkout_session.rs @@ -115,8 +115,8 @@ pub struct CheckoutSession { pub invoice_creation: Option, /// The line items purchased by the customer. - #[serde(default)] - pub line_items: List, + #[serde(skip_serializing_if = "Option::is_none")] + pub line_items: Option>, /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. pub livemode: bool, diff --git a/src/resources/generated/customer.rs b/src/resources/generated/customer.rs index a437b1a84..74290612c 100644 --- a/src/resources/generated/customer.rs +++ b/src/resources/generated/customer.rs @@ -139,8 +139,8 @@ pub struct Customer { pub sources: List, /// The customer's current subscriptions, if any. - #[serde(default)] - pub subscriptions: List, + #[serde(skip_serializing_if = "Option::is_none")] + pub subscriptions: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub tax: Option, @@ -152,8 +152,8 @@ pub struct Customer { pub tax_exempt: Option, /// The customer's tax IDs. - #[serde(default)] - pub tax_ids: List, + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_ids: Option>, /// ID of the test clock that this customer belongs to. #[serde(skip_serializing_if = "Option::is_none")] diff --git a/src/resources/generated/file.rs b/src/resources/generated/file.rs index 8325cc6ac..e88126ffd 100644 --- a/src/resources/generated/file.rs +++ b/src/resources/generated/file.rs @@ -29,8 +29,8 @@ pub struct File { pub filename: Option, /// A list of [file links](https://stripe.com/docs/api#file_links) that point at this file. - #[serde(default)] - pub links: List, + #[serde(skip_serializing_if = "Option::is_none")] + pub links: Option>, /// The [purpose](https://stripe.com/docs/file-upload#uploading-a-file) of the uploaded file. pub purpose: FilePurpose, diff --git a/src/resources/generated/invoice.rs b/src/resources/generated/invoice.rs index acbff7de5..267496ac8 100644 --- a/src/resources/generated/invoice.rs +++ b/src/resources/generated/invoice.rs @@ -284,8 +284,8 @@ pub struct Invoice { /// The individual line items that make up the invoice. /// /// `lines` is sorted as follows: (1) pending invoice items (including prorations) in reverse chronological order, (2) subscription items in reverse chronological order, and (3) invoice items added after invoice creation in chronological order. - #[serde(default)] - pub lines: List, + #[serde(skip_serializing_if = "Option::is_none")] + pub lines: Option>, /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. #[serde(skip_serializing_if = "Option::is_none")] diff --git a/src/resources/generated/payment_link.rs b/src/resources/generated/payment_link.rs index 9c32c330e..ff4b26102 100644 --- a/src/resources/generated/payment_link.rs +++ b/src/resources/generated/payment_link.rs @@ -69,8 +69,8 @@ pub struct PaymentLink { pub invoice_creation: Option, /// The line items representing what is being sold. - #[serde(default)] - pub line_items: List, + #[serde(skip_serializing_if = "Option::is_none")] + pub line_items: Option>, /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. pub livemode: bool, diff --git a/src/resources/generated/quote.rs b/src/resources/generated/quote.rs index e1cca6e89..a7b3beac3 100644 --- a/src/resources/generated/quote.rs +++ b/src/resources/generated/quote.rs @@ -100,8 +100,8 @@ pub struct Quote { pub invoice_settings: InvoiceSettingQuoteSetting, /// A list of items the customer is being quoted for. - #[serde(default)] - pub line_items: List, + #[serde(skip_serializing_if = "Option::is_none")] + pub line_items: Option>, /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. pub livemode: bool, @@ -302,8 +302,8 @@ pub struct QuotesResourceUpfront { /// The line items that will appear on the next invoice after this quote is accepted. /// /// This does not include pending invoice items that exist on the customer but may still be included in the next invoice. - #[serde(default)] - pub line_items: List, + #[serde(skip_serializing_if = "Option::is_none")] + pub line_items: Option>, pub total_details: QuotesResourceTotalDetails, } diff --git a/src/resources/generated/radar_value_list.rs b/src/resources/generated/radar_value_list.rs index c8e8f6d03..4d31a6339 100644 --- a/src/resources/generated/radar_value_list.rs +++ b/src/resources/generated/radar_value_list.rs @@ -40,8 +40,8 @@ pub struct RadarValueList { pub item_type: Option, /// List of items contained within this value list. - #[serde(default)] - pub list_items: List, + #[serde(skip_serializing_if = "Option::is_none")] + pub list_items: Option>, /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. #[serde(skip_serializing_if = "Option::is_none")] diff --git a/src/resources/generated/tax_calculation.rs b/src/resources/generated/tax_calculation.rs index 019df6654..6f98acdc0 100644 --- a/src/resources/generated/tax_calculation.rs +++ b/src/resources/generated/tax_calculation.rs @@ -33,7 +33,7 @@ pub struct TaxCalculation { pub expires_at: Option, /// The list of items the customer is purchasing. - pub line_items: List, + pub line_items: Option>, /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. pub livemode: bool, diff --git a/src/resources/generated/tax_id.rs b/src/resources/generated/tax_id.rs index 74979cdcc..acf08422e 100644 --- a/src/resources/generated/tax_id.rs +++ b/src/resources/generated/tax_id.rs @@ -245,6 +245,7 @@ pub enum CreateTaxIdOwnerType { Account, Application, Customer, + #[serde(rename = "self")] Self_, } @@ -283,6 +284,7 @@ pub enum ListTaxIdsOwnerType { Account, Application, Customer, + #[serde(rename = "self")] Self_, } @@ -321,6 +323,7 @@ pub enum TaxIDsOwnerType { Account, Application, Customer, + #[serde(rename = "self")] Self_, } diff --git a/src/resources/generated/tax_transaction.rs b/src/resources/generated/tax_transaction.rs index 1b963a46c..790efe1d7 100644 --- a/src/resources/generated/tax_transaction.rs +++ b/src/resources/generated/tax_transaction.rs @@ -31,7 +31,7 @@ pub struct TaxTransaction { pub customer_details: TaxProductResourceCustomerDetails, /// The tax collected or refunded, by line item. - pub line_items: List, + pub line_items: Option>, /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. pub livemode: bool, diff --git a/src/resources/generated/treasury_transaction.rs b/src/resources/generated/treasury_transaction.rs index 5ced22510..d90664367 100644 --- a/src/resources/generated/treasury_transaction.rs +++ b/src/resources/generated/treasury_transaction.rs @@ -36,7 +36,7 @@ pub struct TreasuryTransaction { /// A list of TransactionEntries that are part of this Transaction. /// /// This cannot be expanded in any list endpoints. - pub entries: List, + pub entries: Option>, /// The FinancialAccount associated with this object. pub financial_account: String,