Skip to content

Commit 48045f7

Browse files
committed
add multiple output for semi-skimmed endpoint
1 parent 4188c9f commit 48045f7

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nym-api/src/nym_nodes/handlers/unstable/semi_skimmed.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use crate::nym_nodes::handlers::unstable::helpers::{refreshed_at, LegacyAnnotati
77
use crate::nym_nodes::handlers::unstable::NodesParamsWithRole;
88
use crate::support::http::state::AppState;
99
use axum::extract::{Query, State};
10-
use axum::Json;
1110
use nym_api_requests::models::{
1211
NodeAnnotation, NymNodeDescription, OffsetDateTimeJsonSchemaWrapper,
1312
};
@@ -99,12 +98,16 @@ pub struct PaginatedCachedNodesExpandedResponseSchema {
9998
path = "",
10099
context_path = "/v1/unstable/nym-nodes/semi-skimmed",
101100
responses(
102-
(status = 200, body = PaginatedCachedNodesExpandedResponseSchema)
101+
(status = 200, content(
102+
(PaginatedCachedNodesExpandedResponseSchema = "application/json"),
103+
(PaginatedCachedNodesExpandedResponseSchema = "application/yaml"),
104+
(PaginatedCachedNodesExpandedResponseSchema = "application/bincode")
105+
))
103106
)
104107
)]
105108
pub(super) async fn nodes_expanded(
106109
state: State<AppState>,
107-
_query_params: Query<NodesParamsWithRole>,
110+
query_params: Query<NodesParamsWithRole>,
108111
) -> PaginatedSemiSkimmedNodes {
109112
// 1. grab all relevant described nym-nodes
110113
let rewarded_set = state.rewarded_set().await?;
@@ -132,8 +135,6 @@ pub(super) async fn nodes_expanded(
132135
legacy_gateways.timestamp(),
133136
]);
134137

135-
Ok(Json(PaginatedCachedNodesResponse::new_full(
136-
refreshed_at,
137-
nodes,
138-
)))
138+
let output = query_params.output.unwrap_or_default();
139+
Ok(output.to_response(PaginatedCachedNodesResponse::new_full(refreshed_at, nodes)))
139140
}

0 commit comments

Comments
 (0)