Add `utoipa` feature which derives `ToSchema`
Is your feature request related to a problem? Please describe.
Similar to https://github.com/juhaku/utoipa/issues/1347 , the types such as Product don't derive ToSchema which makes running an OpenAPI swagger doc hard to model.
Describe the solution you'd like
Derive ToSchema with the utoipa feature.
Describe alternatives you've considered
No response
Additional context
No response
I don't mind doing this on this side. I'll take a look.
Thank you!
I can do it if needed @arlyon !
I don't think async-stripe need support utoipa, you can use #[schema()] attribute to specify the field type. See https://docs.rs/utoipa/latest/utoipa/derive.ToSchema.html, hope this helpful to you.
use stripe::ProductId;
use utoipa::ToSchema;
#[derive(Deserialize, ToSchema)]
pub(crate) struct CreateProduct {
#[schema(value_type = Vec<String>)]
stripe_product_ids: Vec<ProductId>,
name: String,
icon: Option<String>,
description: Option<String>,
}
I don't want to separately duplicate and maintain all type definitions. That's why I created this issue.
I think I am going to reject this simply because of the many many hours I spend fielding reports of API breakages. The last thing you want is a change to the format the stripe produces causing your public APIs to change (and break). Stripe very much likes to do this. I would encourage you to publish your own domain specific data structures (DTOs) with conversions. Claude should make writing this conversion code pretty straight forward.
It also reduces maintenance burden 😏
Thanks for using async-stripe!