According to API documentation, this is incorrect: it should simply be Option<CurrencyMap<UpdatePriceCurrencyOptions>>.
I took a brief look at the spec and found this interesting definition, so it definitely could be an upstream issue with how Stripe defines this parameter.
```json
"currency_options": {
"anyOf": [
{
"additionalProperties": {
"properties": {
"custom_unit_amount": {
"properties": {
"enabled": {
"type": "boolean"
},
"maximum": {
"type": "integer"
},
"minimum": {
"type": "integer"
},
"preset": {
"type": "integer"
}
},
"required": [
"enabled"
],
"title": "custom_unit_amount",
"type": "object"
},
"tax_behavior": {
"enum": [
"exclusive",
"inclusive",
"unspecified"
],
"type": "string"
},
"tiers": {
"items": {
"properties": {
"flat_amount": {
"type": "integer"
},
"flat_amount_decimal": {
"format": "decimal",
"type": "string"
},
"unit_amount": {
"type": "integer"
},
"unit_amount_decimal": {
"format": "decimal",
"type": "string"
},
"up_to": {
"anyOf": [
{
"enum": [
"inf"
],
"maxLength": 5000,
"type": "string"
},
{
"type": "integer"
}
]
}
},
"required": [
"up_to"
],
"title": "tier",
"type": "object"
},
"type": "array"
},
"unit_amount": {
"type": "integer"
},
"unit_amount_decimal": {
"format": "decimal",
"type": "string"
}
},
"title": "currency_option",
"type": "object"
},
"type": "object"
},
{
"enum": [
""
],
"type": "string"
}
],
"description": "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)."
},
```
It doesn't make much sense to me why they would describe an empty string as valid here, so maybe this union is confusing the generator. Perhaps this is some strange way of defining optionality?
In contrast, this is the spec for the corresponding create price option.
```json
"currency_options": {
"additionalProperties": {
"properties": {
"custom_unit_amount": {
"properties": {
"enabled": {
"type": "boolean"
},
"maximum": {
"type": "integer"
},
"minimum": {
"type": "integer"
},
"preset": {
"type": "integer"
}
},
"required": [
"enabled"
],
"title": "custom_unit_amount",
"type": "object"
},
"tax_behavior": {
"enum": [
"exclusive",
"inclusive",
"unspecified"
],
"type": "string"
},
"tiers": {
"items": {
"properties": {
"flat_amount": {
"type": "integer"
},
"flat_amount_decimal": {
"format": "decimal",
"type": "string"
},
"unit_amount": {
"type": "integer"
},
"unit_amount_decimal": {
"format": "decimal",
"type": "string"
},
"up_to": {
"anyOf": [
{
"enum": [
"inf"
],
"maxLength": 5000,
"type": "string"
},
{
"type": "integer"
}
]
}
},
"required": [
"up_to"
],
"title": "tier",
"type": "object"
},
"type": "array"
},
"unit_amount": {
"type": "integer"
},
"unit_amount_decimal": {
"format": "decimal",
"type": "string"
}
},
"title": "currency_option",
"type": "object"
},
"description": "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).",
"type": "object"
},
```
Notice the lack of union.
### To Reproduce
1. View [Stripe API documentation](https://stripe.com/docs/api/prices/update) for updating a price
2. View [generated `async-stripe` type](https://docs.rs/async-stripe/0.29.0/stripe/struct.UpdatePrice.html#structfield.currency_options) for updating a price
3. Observe `currency_options` is typed differently
### Expected behavior
`async-stripe` type for updating a price `currency_options` should match the API type for updating a price `currency_options`.
### Code snippets
_No response_
### OS
Windows
### Rust version
rustc 1.74.1 (a28077b28 2023-12-04)
### Library version
async-stripe 0.29.0
### API version
2023-10-16
### Additional context
_No response_
Describe the bug
UpdatePrice::currency_options
is typed asOption<CurrencyMap<Option<CurrencyMap<UpdatePriceCurrencyOptions>>>>
.https://github.com/arlyon/async-stripe/blob/8d799cdd27635b14ccdc417c8995282832900ac6/src/resources/generated/price.rs#L486-L490
According to API documentation, this is incorrect: it should simply be
Option<CurrencyMap<UpdatePriceCurrencyOptions>>
.I took a brief look at the spec and found this interesting definition, so it definitely could be an upstream issue with how Stripe defines this parameter.
```json "currency_options": { "anyOf": [ { "additionalProperties": { "properties": { "custom_unit_amount": { "properties": { "enabled": { "type": "boolean" }, "maximum": { "type": "integer" }, "minimum": { "type": "integer" }, "preset": { "type": "integer" } }, "required": [ "enabled" ], "title": "custom_unit_amount", "type": "object" }, "tax_behavior": { "enum": [ "exclusive", "inclusive", "unspecified" ], "type": "string" }, "tiers": { "items": { "properties": { "flat_amount": { "type": "integer" }, "flat_amount_decimal": { "format": "decimal", "type": "string" }, "unit_amount": { "type": "integer" }, "unit_amount_decimal": { "format": "decimal", "type": "string" }, "up_to": { "anyOf": [ { "enum": [ "inf" ], "maxLength": 5000, "type": "string" }, { "type": "integer" } ] } }, "required": [ "up_to" ], "title": "tier", "type": "object" }, "type": "array" }, "unit_amount": { "type": "integer" }, "unit_amount_decimal": { "format": "decimal", "type": "string" } }, "title": "currency_option", "type": "object" }, "type": "object" }, { "enum": [ "" ], "type": "string" } ], "description": "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)." }, ```It doesn't make much sense to me why they would describe an empty string as valid here, so maybe this union is confusing the generator. Perhaps this is some strange way of defining optionality?
In contrast, this is the spec for the corresponding create price option.
```json "currency_options": { "additionalProperties": { "properties": { "custom_unit_amount": { "properties": { "enabled": { "type": "boolean" }, "maximum": { "type": "integer" }, "minimum": { "type": "integer" }, "preset": { "type": "integer" } }, "required": [ "enabled" ], "title": "custom_unit_amount", "type": "object" }, "tax_behavior": { "enum": [ "exclusive", "inclusive", "unspecified" ], "type": "string" }, "tiers": { "items": { "properties": { "flat_amount": { "type": "integer" }, "flat_amount_decimal": { "format": "decimal", "type": "string" }, "unit_amount": { "type": "integer" }, "unit_amount_decimal": { "format": "decimal", "type": "string" }, "up_to": { "anyOf": [ { "enum": [ "inf" ], "maxLength": 5000, "type": "string" }, { "type": "integer" } ] } }, "required": [ "up_to" ], "title": "tier", "type": "object" }, "type": "array" }, "unit_amount": { "type": "integer" }, "unit_amount_decimal": { "format": "decimal", "type": "string" } }, "title": "currency_option", "type": "object" }, "description": "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).", "type": "object" }, ``` Notice the lack of union. ### To Reproduce 1. View [Stripe API documentation](https://stripe.com/docs/api/prices/update) for updating a price 2. View [generated `async-stripe` type](https://docs.rs/async-stripe/0.29.0/stripe/struct.UpdatePrice.html#structfield.currency_options) for updating a price 3. Observe `currency_options` is typed differently ### Expected behavior `async-stripe` type for updating a price `currency_options` should match the API type for updating a price `currency_options`. ### Code snippets _No response_ ### OS Windows ### Rust version rustc 1.74.1 (a28077b28 2023-12-04) ### Library version async-stripe 0.29.0 ### API version 2023-10-16 ### Additional context _No response_