We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following code shows the response as { data: string, error: string } in Swagger instead of resolving the inner struct.
{ data: string, error: string }
#[derive(OpenApi)] #[openapi( paths(get_usage), tags((name = "Account Usage")), components(schemas(crate::api::v1::usage::schemas::Window, JsonAccountUsage, AccountUsage)) )] pub struct ApiDoc; #[derive(Serialize, Deserialize, Debug, ToSchema)] #[aliases(JsonAccountUsage = JsonResponse<AccountUsage>)] pub struct JsonResponse<T> where T: Serialize, { pub data: Option<T>, pub error: Option<String>, } #[derive(Debug, FromQueryResult, Serialize, Deserialize, ToSchema)] pub struct AccountUsage { #[serde(with = "services::serde::time")] pub window_start: OffsetDateTime, #[serde(with = "services::serde::time")] pub window_end: OffsetDateTime, pub account: Uuid, pub instance: Option<Uuid>, pub method: Option<String>, pub archive: Option<bool>, pub chain: Option<String>, pub network: Option<String>, pub addon: Option<i32>, pub multiplier: Option<i32>, pub usage: i64, pub credits: i64, } #[utoipa::path( get, path = "/{account}/usage", responses( (status = 200, body = BillingAccountUsage), ), tag = "Account Usage", params( ("account" = Uuid, Path, description = "Account UUID"), AccountUsageParams, ) )] pub async fn get_usage( ...
The text was updated successfully, but these errors were encountered:
@theelderbeever There is now new implementation for generics coming up in #1034 which should solve the issue with aliases approach.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
The following code shows the response as
{ data: string, error: string }
in Swagger instead of resolving the inner struct.The text was updated successfully, but these errors were encountered: