Skip to content

Commit

Permalink
DEX-919 Swagger errors (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsuharnikov committed Sep 10, 2020
1 parent 41db755 commit 9900415
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 64 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ inScope(Global)(
organization := "com.wavesplatform",
organizationName := "Waves Platform",
organizationHomepage := Some(url("https://wavesplatform.com")),
scmInfo := Some(ScmInfo(url("https://github.com/wavesplatform/dex"), "[email protected]:wavesplatform/dex.git", None)),
licenses := Seq(("MIT", url("https://github.com/wavesplatform/dex/blob/master/LICENSE"))),
scmInfo := Some(ScmInfo(url("https://github.com/wavesplatform/matcher"), "[email protected]:wavesplatform/matcher.git", None)),
licenses := Seq(("MIT", url("https://github.com/wavesplatform/matcher/blob/master/LICENSE"))),
scalacOptions ++= Seq(
"-feature",
"-deprecation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import io.swagger.models.auth.{ApiKeyAuthDefinition, In}
class SwaggerDocService(val apiClasses: Set[Class[_]], override val host: String) extends SwaggerHttpService {

override val info: Info = Info(
"The Web Interface to the Waves DEX API",
Version.VersionString,
"Waves DEX",
"License: MIT License",
None,
Some(License("MIT License", "https://github.com/wavesplatform/dex/blob/master/LICENSE"))
description = "The Web Interface to the Waves Matcher Server API",
version = Version.VersionString,
title = "Waves Matcher Server",
license = Some(License("MIT License", "https://github.com/wavesplatform/matcher/blob/master/LICENSE"))
)

// Let swagger-ui determine the host and port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@ case class HttpMarketDataWithMeta(
@ApiModelProperty(
value = "Base58 encoded amount asset ID",
dataType = "string",
example = "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
example = "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
required = true
) amountAsset: Asset,
@ApiModelProperty(example = "BTC") amountAssetName: String,
@ApiModelProperty(value = "Info about amount asset decimals", allowEmptyValue = true) amountAssetInfo: Option[HttpAssetInfo],
@ApiModelProperty(example = "BTC", required = true)
amountAssetName: String,
@ApiModelProperty(value = "Info about amount asset decimals", required = true)
amountAssetInfo: Option[HttpAssetInfo],
@ApiModelProperty(
value = "Base58 encoded price asset ID",
dataType = "string",
example = "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ"
example = "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ",
required = true
) priceAsset: Asset,
@ApiModelProperty(example = "USDT") priceAssetName: String,
@ApiModelProperty(value = "Info about price asset decimals", allowEmptyValue = true) priceAssetInfo: Option[HttpAssetInfo],
@ApiModelProperty() created: Long,
@ApiModelProperty(allowEmptyValue = true) restrictions: Option[HttpOrderRestrictions],
@ApiModelProperty() matchingRules: HttpMatchingRules)
@ApiModelProperty(example = "USDT", required = true) priceAssetName: String,
@ApiModelProperty(value = "Info about price asset decimals") priceAssetInfo: Option[HttpAssetInfo],
@ApiModelProperty(required = true) created: Long,
@ApiModelProperty() restrictions: Option[HttpOrderRestrictions],
@ApiModelProperty(required = true) matchingRules: HttpMatchingRules
)

object HttpMarketDataWithMeta {
implicit val httpMarketDataWithMetaFormat: OFormat[HttpMarketDataWithMeta] = Json.format[HttpMarketDataWithMeta]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,18 @@ import com.wavesplatform.dex.model.{LastTrade, LevelAgg}
import io.swagger.annotations.ApiModelProperty
import play.api.libs.json.{Json, OFormat}

case class HttpMarketStatus(@ApiModelProperty(
allowEmptyValue = true,
dataType = "integer"
) lastPrice: Option[Long],
@ApiModelProperty(
allowEmptyValue = true,
dataType = "integer"
) lastAmount: Option[Long],
case class HttpMarketStatus(@ApiModelProperty(dataType = "integer") lastPrice: Option[Long],
@ApiModelProperty(dataType = "integer") lastAmount: Option[Long],
@ApiModelProperty(
value = "Side (sell or buy)",
dataType = "string",
example = "buy",
allowEmptyValue = true
example = "buy"
)
lastSide: Option[OrderType],
@ApiModelProperty(
allowEmptyValue = true,
dataType = "integer"
) bid: Option[Long],
@ApiModelProperty(
allowEmptyValue = true,
dataType = "integer"
) bidAmount: Option[Long],
@ApiModelProperty(
allowEmptyValue = true,
dataType = "integer"
) ask: Option[Long],
@ApiModelProperty(
allowEmptyValue = true,
dataType = "integer"
) askAmount: Option[Long]) {
@ApiModelProperty(dataType = "integer") bid: Option[Long],
@ApiModelProperty(dataType = "integer") bidAmount: Option[Long],
@ApiModelProperty(dataType = "integer") ask: Option[Long],
@ApiModelProperty(dataType = "integer") askAmount: Option[Long]) {

@ApiModelProperty(hidden = true)
val lastTrade: Option[LastTrade] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@ package com.wavesplatform.dex.api.http.entities
import io.swagger.annotations.ApiModelProperty
import play.api.libs.json.{Json, OFormat}

case class HttpOrderBookInfo(@ApiModelProperty(
value = "Restrictions of orders' amount and price",
allowEmptyValue = true
) restrictions: Option[HttpOrderRestrictions],
@ApiModelProperty(
value = "Matching rules, tick size in particular",
allowEmptyValue = true
)
matchingRules: HttpMatchingRules)
case class HttpOrderBookInfo(@ApiModelProperty(value = "Restrictions of orders' amount and price")
restrictions: Option[HttpOrderRestrictions],
@ApiModelProperty(value = "Matching rules, tick size in particular", required = true)
matchingRules: HttpMatchingRules)

object HttpOrderBookInfo {
implicit val httpOrderBookInfoFormat: OFormat[HttpOrderBookInfo] = Json.format[HttpOrderBookInfo]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,19 @@ import play.api.libs.json.{Format, Json, Reads, Writes}

case class HttpOrderStatus(@ApiModelProperty(
dataType = "string",
allowableValues = "Accepted, NotFound, PartiallyFilled, Filled, Cancelled"
allowableValues = "Accepted, NotFound, PartiallyFilled, Filled, Cancelled",
required = true
) status: Status,
@ApiModelProperty(
value = "Filled amount of existed order",
dataType = "integer",
allowEmptyValue = true
dataType = "integer"
) filledAmount: Option[Long] = None,
@ApiModelProperty(
value = "Filled fee of existed order",
dataType = "integer",
allowEmptyValue = true
dataType = "integer"
) filledFee: Option[Long] = None,
@ApiModelProperty(
value = "Brief message in case of not existed order",
allowEmptyValue = true
value = "Brief message in case of not existed order"
) message: Option[String] = None)

object HttpOrderStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ case class HttpCancelOrder(@ApiModelProperty(
@ApiModelProperty(
value = "Base58 encoded Order ID",
dataType = "string",
example = "7VEr4T9icqopHWLawGAZ7AQiJbjAcnzXn65ekYvbpwnN",
allowEmptyValue = true
example = "7VEr4T9icqopHWLawGAZ7AQiJbjAcnzXn65ekYvbpwnN"
) orderId: Option[ByteStr],
@ApiModelProperty(allowEmptyValue = true, dataType = "integer") timestamp: Option[Long],
@ApiModelProperty(dataType = "integer") timestamp: Option[Long],
@ApiModelProperty(
value =
"""Base58 encoded signature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.wavesplatform.dex.actors.address.AddressActor.OrderListType
import com.wavesplatform.dex.actors.address.{AddressActor, AddressDirectoryActor}
import com.wavesplatform.dex.api.http._
import com.wavesplatform.dex.api.http.entities._
import com.wavesplatform.dex.api.http.headers.{MatcherHttpServer, `X-User-Public-Key`}
import com.wavesplatform.dex.api.http.headers.`X-User-Public-Key`
import com.wavesplatform.dex.api.http.protocol.HttpCancelOrder
import com.wavesplatform.dex.api.routes.{ApiRoute, AuthRoute}
import com.wavesplatform.dex.caches.RateCache
Expand Down Expand Up @@ -850,7 +850,8 @@ class MatcherApiRoute(assetPairBuilder: AssetPairBuilder,
}
}

@Path("/orderbook/{publicKey}/{orderId}")
// https://github.com/OAI/OpenAPI-Specification/issues/146#issuecomment-117288707
@Path("/orderbook/{publicKey}/{orderId}#getOrderStatusInfoByIdWithSignature")
@ApiOperation(
value = "Order Status Info by Public Key and ID",
notes = "Get Status Info of the specified order for a given public key",
Expand Down

0 comments on commit 9900415

Please sign in to comment.