Skip to content

Commit b8b3857

Browse files
authored
Merge pull request #43 from virtualeconomy/bugfix/swagger-ui
Fix error of swagger ui
2 parents 026d997 + 3448c94 commit b8b3857

File tree

6 files changed

+39
-40
lines changed

6 files changed

+39
-40
lines changed

project/Dependencies.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import sbt._
44
object Dependencies {
55

66
def akkaModule(module: String) = "com.typesafe.akka" %% s"akka-$module" % "2.4.19"
7-
def swaggerModule(module: String) = "io.swagger" % s"swagger-$module" % "1.5.16"
7+
def swaggerModule(module: String) = ("io.swagger" % s"swagger-$module" % "1.5.22").exclude("com.google.guava", "guava")
88
def akkaHttpModule(module: String) = "com.typesafe.akka" %% module % "10.0.9"
99
def nettyModule(module: String) = "io.netty" % s"netty-$module" % "4.1.24.Final"
1010
def kamonModule(module: String) = "io.kamon" %% s"kamon-$module" % "0.6.7"
@@ -54,7 +54,7 @@ object Dependencies {
5454

5555
lazy val http = Seq("core", "annotations", "models", "jaxrs").map(swaggerModule) ++ Seq(
5656
"io.swagger" %% "swagger-scala-module" % "1.0.4",
57-
"com.github.swagger-akka-http" %% "swagger-akka-http" % "0.9.2",
57+
"com.github.swagger-akka-http" %% "swagger-akka-http" % "1.0.0",
5858
akkaHttpModule("akka-http")
5959
)
6060

src/main/scala/com/wavesplatform/Application.scala

+23-23
Original file line numberDiff line numberDiff line change
@@ -111,29 +111,29 @@ class Application(val actorSystem: ActorSystem, val settings: VsysSettings) exte
111111
DbApiRoute(settings.restAPISettings, wallet, utxStorage, allChannels, time, stateReader)
112112
)
113113

114-
val apiTypes = Seq(
115-
typeOf[BlocksApiRoute],
116-
typeOf[TransactionsApiRoute],
117-
typeOf[SposConsensusApiRoute],
118-
typeOf[WalletApiRoute],
119-
typeOf[PaymentApiRoute],
120-
typeOf[UtilsApiRoute],
121-
typeOf[PeersApiRoute],
122-
typeOf[AddressApiRoute],
123-
typeOf[DebugApiRoute],
124-
//typeOf[WavesApiRoute],
125-
//typeOf[AssetsApiRoute],
126-
typeOf[NodeApiRoute],
127-
//typeOf[AssetsBroadcastApiRoute],
128-
typeOf[LeaseApiRoute],
129-
typeOf[LeaseBroadcastApiRoute],
130-
//typeOf[AliasApiRoute],
131-
//typeOf[AliasBroadcastApiRoute],
132-
typeOf[SPOSApiRoute],
133-
typeOf[SPOSBroadcastApiRoute],
134-
//typeOf[ContractApiRoute],
135-
//typeOf[ContractBroadcastApiRoute],
136-
typeOf[DbApiRoute]
114+
val apiTypes: Set[Class[_]] = Set(
115+
classOf[BlocksApiRoute],
116+
classOf[TransactionsApiRoute],
117+
classOf[SposConsensusApiRoute],
118+
classOf[WalletApiRoute],
119+
classOf[PaymentApiRoute],
120+
classOf[UtilsApiRoute],
121+
classOf[PeersApiRoute],
122+
classOf[AddressApiRoute],
123+
classOf[DebugApiRoute],
124+
//classOf[WavesApiRoute],
125+
//classOf[AssetsApiRoute],
126+
classOf[NodeApiRoute],
127+
//classOf[AssetsBroadcastApiRoute],
128+
classOf[LeaseApiRoute],
129+
classOf[LeaseBroadcastApiRoute],
130+
//classOf[AliasApiRoute],
131+
//classOf[AliasBroadcastApiRoute],
132+
classOf[SPOSApiRoute],
133+
classOf[SPOSBroadcastApiRoute],
134+
//classOf[ContractApiRoute],
135+
//classOf[ContractBroadcastApiRoute],
136+
classOf[DbApiRoute]
137137
)
138138

139139
for (addr <- settings.networkSettings.declaredAddress if settings.networkSettings.uPnPSettings.enable) {

src/main/scala/com/wavesplatform/matcher/Matcher.scala

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import vsys.wallet.Wallet
1919

2020
import scala.concurrent.Await
2121
import scala.concurrent.duration._
22-
import scala.reflect.runtime.universe._
2322

2423
class Matcher(actorSystem: ActorSystem,
2524
wallet: Wallet,
@@ -33,8 +32,8 @@ class Matcher(actorSystem: ActorSystem,
3332
MatcherApiRoute(wallet, stateReader, matcher, orderHistory, txWriter, restAPISettings, matcherSettings)
3433
)
3534

36-
lazy val matcherApiTypes = Seq(
37-
typeOf[MatcherApiRoute]
35+
lazy val matcherApiTypes: Set[Class[_]] = Set(
36+
classOf[MatcherApiRoute]
3837
)
3938

4039
lazy val matcher: ActorRef = actorSystem.actorOf(MatcherActor.props(orderHistory, stateReader, wallet, utx, allChannels,

src/main/scala/scorex/api/http/CompositeHttpService.scala

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ import akka.stream.ActorMaterializer
1010
import com.wavesplatform.settings.RestAPISettings
1111
import scorex.api.http.swagger.SwaggerDocService
1212

13-
import scala.reflect.runtime.universe.Type
14-
15-
case class CompositeHttpService(system: ActorSystem, apiTypes: Seq[Type], routes: Seq[ApiRoute], settings: RestAPISettings) {
13+
case class CompositeHttpService(system: ActorSystem, apiTypes: Set[Class[_]], routes: Seq[ApiRoute], settings: RestAPISettings) {
1614

1715
val swaggerService = new SwaggerDocService(system, ActorMaterializer()(system), apiTypes, settings)
1816

src/main/scala/scorex/api/http/swagger/SwaggerDocService.scala

+9-7
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ package scorex.api.http.swagger
33
import akka.actor.ActorSystem
44
import akka.stream.ActorMaterializer
55
import com.github.swagger.akka.model.{Info, License}
6-
import com.github.swagger.akka.{HasActorSystem, SwaggerHttpService}
6+
import com.github.swagger.akka.SwaggerHttpService
77
import com.wavesplatform.Version
88
import com.wavesplatform.settings.RestAPISettings
9-
import io.swagger.models.Swagger
9+
import io.swagger.models.{Swagger, Scheme}
1010

11-
import scala.reflect.runtime.universe.Type
12-
13-
class SwaggerDocService(val actorSystem: ActorSystem, val materializer: ActorMaterializer, val apiTypes: Seq[Type], settings: RestAPISettings)
14-
extends SwaggerHttpService with HasActorSystem {
11+
class SwaggerDocService(val actorSystem: ActorSystem, val materializer: ActorMaterializer, val apiClasses: Set[Class[_]], settings: RestAPISettings)
12+
extends SwaggerHttpService {
1513

1614
override val host: String = settings.bindAddress + ":" + settings.port
1715
override val info: Info = Info("The Web Interface to the VSYS Full Node API",
@@ -23,5 +21,9 @@ class SwaggerDocService(val actorSystem: ActorSystem, val materializer: ActorMat
2321
)
2422

2523
//Let swagger-ui determine the host and port
26-
override val swaggerConfig: Swagger = new Swagger().basePath(prependSlashIfNecessary(basePath)).info(info).scheme(scheme)
24+
override val swaggerConfig: Swagger = new Swagger()
25+
.basePath(SwaggerHttpService.prependSlashIfNecessary(basePath))
26+
.info(info)
27+
.scheme(Scheme.HTTP)
28+
.scheme(Scheme.HTTPS)
2729
}

src/main/scala/vsys/api/http/database/DbApiRoute.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ case class DbApiRoute (settings: RestAPISettings, wallet: Wallet, utx: UtxPool,
6969
@Path("/get/{nameSpace}/{dbKey}")
7070
@ApiOperation(value = "get", notes = "Get db entry", httpMethod = "GET")
7171
@ApiImplicitParams(Array(
72-
new ApiImplicitParam(name = "nameSpace", value = "Address", required = true, dataType = "String", paramType = "path"),
73-
new ApiImplicitParam(name = "dbKey", value = "dbKey", required = true, dataType = "String", paramType = "path")
72+
new ApiImplicitParam(name = "nameSpace", value = "Address", required = true, dataType = "string", paramType = "path"),
73+
new ApiImplicitParam(name = "dbKey", value = "dbKey", required = true, dataType = "string", paramType = "path")
7474
))
7575
def getKV: Route = {
7676
(path("get" / Segment / Segment) & get) { case (addr, dbKey) => {

0 commit comments

Comments
 (0)