add multiple output for semi-skimmed endpoint

This commit is contained in:
Simon Wicky
2025-05-20 16:18:09 +02:00
parent 4188c9fce4
commit 48045f79d7
2 changed files with 9 additions and 8 deletions
Generated
+1 -1
View File
@@ -6428,7 +6428,7 @@ dependencies = [
"nym-crypto",
"nym-noise-keys",
"pin-project",
"sha2 0.10.8",
"sha2 0.10.9",
"snow",
"strum 0.26.3",
"thiserror 2.0.12",
@@ -7,7 +7,6 @@ use crate::nym_nodes::handlers::unstable::helpers::{refreshed_at, LegacyAnnotati
use crate::nym_nodes::handlers::unstable::NodesParamsWithRole;
use crate::support::http::state::AppState;
use axum::extract::{Query, State};
use axum::Json;
use nym_api_requests::models::{
NodeAnnotation, NymNodeDescription, OffsetDateTimeJsonSchemaWrapper,
};
@@ -99,12 +98,16 @@ pub struct PaginatedCachedNodesExpandedResponseSchema {
path = "",
context_path = "/v1/unstable/nym-nodes/semi-skimmed",
responses(
(status = 200, body = PaginatedCachedNodesExpandedResponseSchema)
(status = 200, content(
(PaginatedCachedNodesExpandedResponseSchema = "application/json"),
(PaginatedCachedNodesExpandedResponseSchema = "application/yaml"),
(PaginatedCachedNodesExpandedResponseSchema = "application/bincode")
))
)
)]
pub(super) async fn nodes_expanded(
state: State<AppState>,
_query_params: Query<NodesParamsWithRole>,
query_params: Query<NodesParamsWithRole>,
) -> PaginatedSemiSkimmedNodes {
// 1. grab all relevant described nym-nodes
let rewarded_set = state.rewarded_set().await?;
@@ -132,8 +135,6 @@ pub(super) async fn nodes_expanded(
legacy_gateways.timestamp(),
]);
Ok(Json(PaginatedCachedNodesResponse::new_full(
refreshed_at,
nodes,
)))
let output = query_params.output.unwrap_or_default();
Ok(output.to_response(PaginatedCachedNodesResponse::new_full(refreshed_at, nodes)))
}