Closed ernestas-poskus closed 7 months ago
cc @arlyon
Hi! Unfortunately I cannot accept changes to the generated code since each week it is overwritten by the open api spec. There are two places this could be incorrect. First, the spec may be wrong (please check out the stripe open api repo to confirm). If the open api is correct, then it must be that our codegen is wrong and we will have to look deeper into it. Let me know what you would like to do.
Thanks will check the spec
I haven't found any conditional difference between CreatePrice and UpdatePrice in stripe.json spec
However codegen generates:
/// The parameters for `Price::create`.
#[derive(Clone, Debug, Serialize)]
pub struct CreatePrice<'a> {
/// Prices defined in each available currency option.
///
/// 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<CreatePriceCurrencyOptions>>,
and UpdatePrice
/// The parameters for `Price::update`.
#[derive(Clone, Debug, Serialize, Default)]
pub struct UpdatePrice<'a> {
/// Prices defined in each available currency option.
///
/// 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>>>>,
The former is incorrect because it requires one to supply an optional map that has keys defined as an optional currency map with keys and then a price update struct.
Fixing resource update_price currency_options field type.
It should be optional currency with update options as a value
Docs: https://stripe.com/docs/api/prices/update
Codegen: https://github.com/arlyon/async-stripe/blob/master/openapi/src/codegen.rs#L1280
Checklist
cargo make fmt