Skip to content

Commit

Permalink
Schema improvements (#22)
Browse files Browse the repository at this point in the history
* fix opportunity_id type error

* fix missing schema via value type specifications in place of alias

* unix i64 fix

* fix OpportunityParams schema

* address comments

---------

Co-authored-by: --systemdf <[email protected]>
Co-authored-by: --systemdf <[email protected]>
  • Loading branch information
3 people authored Feb 26, 2024
1 parent 4dd7653 commit 2a9bb91
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions auction-server/src/api/liquidation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ pub struct OpportunityParamsWithMetadata {
#[schema(example = "f47ac10b-58cc-4372-a567-0e02b2c3d479", value_type=String)]
opportunity_id: Uuid,
/// Creation time of the opportunity
#[schema(example = "1700000000")]
#[schema(example = 1700000000, value_type=i64)]
creation_time: UnixTimestamp,
/// opportunity data
#[serde(flatten)]
// expands params into component fields in the generated client schemas
#[schema(inline)]
params: OpportunityParams,
}

Expand Down Expand Up @@ -237,7 +239,7 @@ pub struct OpportunityBid {

/// Bid on liquidation opportunity
#[utoipa::path(post, path = "/v1/liquidation/opportunities/{opportunity_id}/bids", request_body=OpportunityBid,
params(("opportunity_id", description = "Opportunity id to bid on")), responses(
params(("opportunity_id"=String, description = "Opportunity id to bid on")), responses(
(status = 200, description = "Bid Result", body = BidResult, example = json!({"status": "OK"})),
(status = 400, response = ErrorBodyResponse),
(status = 404, description = "Opportunity or chain id was not found", body = ErrorBodyResponse),
Expand Down
10 changes: 8 additions & 2 deletions auction-server/src/api/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,15 @@ pub struct WsState {
#[serde(tag = "method", content = "params")]
pub enum ClientMessage {
#[serde(rename = "subscribe")]
Subscribe { chain_ids: Vec<ChainId> },
Subscribe {
#[schema(value_type = Vec<String>)]
chain_ids: Vec<ChainId>,
},
#[serde(rename = "unsubscribe")]
Unsubscribe { chain_ids: Vec<ChainId> },
Unsubscribe {
#[schema(value_type = Vec<String>)]
chain_ids: Vec<ChainId>,
},
}

#[derive(Deserialize, Debug, Clone, ToSchema)]
Expand Down

0 comments on commit 2a9bb91

Please sign in to comment.