Skip to content

Commit

Permalink
[hermes] fix v2 endpoints return format (#1299)
Browse files Browse the repository at this point in the history
* remove outermost array

* bump
  • Loading branch information
cctdaniel authored Feb 16, 2024
1 parent e14a82c commit 25cf8f8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion hermes/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hermes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hermes"
version = "0.5.1"
version = "0.5.2"
description = "Hermes is an agent that provides Verified Prices from the Pythnet Pyth Oracle."
edition = "2021"

Expand Down
6 changes: 3 additions & 3 deletions hermes/src/api/rest/v2/latest_price_updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn default_true() -> bool {
get,
path = "/v2/updates/price/latest",
responses(
(status = 200, description = "Price updates retrieved successfully", body = Vec<PriceUpdate>),
(status = 200, description = "Price updates retrieved successfully", body = PriceUpdate),
(status = 404, description = "Price ids not found", body = String)
),
params(
Expand All @@ -76,7 +76,7 @@ fn default_true() -> bool {
pub async fn latest_price_updates(
State(state): State<crate::api::ApiState>,
QsQuery(params): QsQuery<LatestPriceUpdatesQueryParams>,
) -> Result<Json<Vec<PriceUpdate>>, RestError> {
) -> Result<Json<PriceUpdate>, RestError> {
let price_ids: Vec<PriceIdentifier> = params.ids.into_iter().map(|id| id.into()).collect();

verify_price_ids_exist(&state, &price_ids).await?;
Expand Down Expand Up @@ -126,5 +126,5 @@ pub async fn latest_price_updates(
};


Ok(Json(vec![compressed_price_update]))
Ok(Json(compressed_price_update))
}
6 changes: 3 additions & 3 deletions hermes/src/api/rest/v2/timestamp_price_updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fn default_true() -> bool {
get,
path = "/v2/updates/price/{publish_time}",
responses(
(status = 200, description = "Price updates retrieved successfully", body = Vec<PriceUpdate>),
(status = 200, description = "Price updates retrieved successfully", body = PriceUpdate),
(status = 404, description = "Price ids not found", body = String)
),
params(
Expand All @@ -91,7 +91,7 @@ pub async fn timestamp_price_updates(
State(state): State<crate::api::ApiState>,
Path(path_params): Path<TimestampPriceUpdatesPathParams>,
QsQuery(query_params): QsQuery<TimestampPriceUpdatesQueryParams>,
) -> Result<Json<Vec<PriceUpdate>>, RestError> {
) -> Result<Json<PriceUpdate>, RestError> {
let price_ids: Vec<PriceIdentifier> =
query_params.ids.into_iter().map(|id| id.into()).collect();

Expand Down Expand Up @@ -139,5 +139,5 @@ pub async fn timestamp_price_updates(
};


Ok(Json(vec![compressed_price_update]))
Ok(Json(compressed_price_update))
}

0 comments on commit 25cf8f8

Please sign in to comment.