Эх сурвалжийг харах

[hermes] fix v2 endpoints return format (#1299)

* remove outermost array

* bump
Daniel Chew 1 жил өмнө
parent
commit
25cf8f8185

+ 1 - 1
hermes/Cargo.lock

@@ -1574,7 +1574,7 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
 
 [[package]]
 name = "hermes"
-version = "0.5.1"
+version = "0.5.2"
 dependencies = [
  "anyhow",
  "async-trait",

+ 1 - 1
hermes/Cargo.toml

@@ -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"
 

+ 3 - 3
hermes/src/api/rest/v2/latest_price_updates.rs

@@ -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(
@@ -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?;
@@ -126,5 +126,5 @@ pub async fn latest_price_updates(
     };
 
 
-    Ok(Json(vec![compressed_price_update]))
+    Ok(Json(compressed_price_update))
 }

+ 3 - 3
hermes/src/api/rest/v2/timestamp_price_updates.rs

@@ -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(
@@ -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();
 
@@ -139,5 +139,5 @@ pub async fn timestamp_price_updates(
     };
 
 
-    Ok(Json(vec![compressed_price_update]))
+    Ok(Json(compressed_price_update))
 }