Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ScalatraBootstrap extends LifeCycle {
override def init(context: ServletContext) {
implicit val system = ActorSystem("appActorSystem")
try {
{{#apiInfo}}{{#apis}}context mount (new {{classname}}, "/{{baseName}}/*")
{{#apiInfo}}{{#apis}}context mount (new {{classname}}, "{{basePathWithoutHost}}/{{baseName}}/*")
{{/apis}}{{/apiInfo}}
context mount (new ResourcesApp, "/api-docs/*")
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import org.scalatra.servlet.{FileUploadSupport, MultipartConfig, SizeConstraintE

import scala.collection.JavaConverters._

class {{classname}} (implicit val swagger: Swagger) extends ScalatraServlet
class {{classname}} (implicit val swagger: Swagger) extends ScalatraServlet
with FileUploadSupport
with JacksonJsonSupport
with SwaggerSupport {
protected implicit val jsonFormats: Formats = DefaultFormats

protected val applicationDescription: String = "{{classname}}"
override protected val applicationName: Option[String] = Some("{{baseName}}")
override protected val applicationName: Option[String] = Some("{{basePathWithoutHost}}/{{baseName}}")

before() {
contentType = formats("json")
Expand Down Expand Up @@ -51,4 +51,4 @@ class {{classname}} (implicit val swagger: Swagger) extends ScalatraServlet

{{/operation}}
{{/operations}}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ class ScalatraBootstrap extends LifeCycle {
override def init(context: ServletContext) {
implicit val system = ActorSystem("appActorSystem")
try {
context mount (new PetApi, "/Pet/*")
context mount (new StoreApi, "/Store/*")
context mount (new UserApi, "/User/*")

context mount (new PetApi, "/v2/Pet/*")
context mount (new StoreApi, "/v2/Store/*")
context mount (new UserApi, "/v2/User/*")
context mount (new ResourcesApp, "/api-docs/*")
} catch {
case e: Throwable => e.printStackTrace()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class PetApi(implicit val swagger: Swagger) extends ScalatraServlet
protected implicit val jsonFormats: Formats = DefaultFormats

protected val applicationDescription: String = "PetApi"
override protected val applicationName: Option[String] = Some("Pet")
override protected val applicationName: Option[String] = Some("/v2/Pet")

before() {
contentType = formats("json")
Expand Down Expand Up @@ -89,7 +89,7 @@ class PetApi(implicit val swagger: Swagger) extends ScalatraServlet
get("/pet/findByStatus", operation(findPetsByStatusOperation)) {

val statusString = params.getAs[String]("status")
val status = if ("csv".equals("default")) {
val status = if ("multi".equals("default")) {
statusString match {
case Some(str) => str.split(",")
case None => List()
Expand All @@ -108,7 +108,7 @@ class PetApi(implicit val swagger: Swagger) extends ScalatraServlet
get("/pet/findByTags", operation(findPetsByTagsOperation)) {

val tagsString = params.getAs[String]("tags")
val tags = if ("csv".equals("default")) {
val tags = if ("multi".equals("default")) {
tagsString match {
case Some(str) => str.split(",")
case None => List()
Expand Down Expand Up @@ -181,4 +181,4 @@ class PetApi(implicit val swagger: Swagger) extends ScalatraServlet
println("file: " + file)
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class StoreApi(implicit val swagger: Swagger) extends ScalatraServlet
protected implicit val jsonFormats: Formats = DefaultFormats

protected val applicationDescription: String = "StoreApi"
override protected val applicationName: Option[String] = Some("Store")
override protected val applicationName: Option[String] = Some("/v2/Store")

before() {
contentType = formats("json")
Expand All @@ -53,7 +53,7 @@ class StoreApi(implicit val swagger: Swagger) extends ScalatraServlet

val deleteOrderOperation = (apiOperation[Unit]("deleteOrder")
summary "Delete purchase order by ID"
parameters (pathParam[String]("orderId").description(""))
parameters (pathParam[Long]("orderId").description(""))
)

delete("/store/order/{orderId}", operation(deleteOrderOperation)) {
Expand Down Expand Up @@ -95,4 +95,4 @@ class StoreApi(implicit val swagger: Swagger) extends ScalatraServlet
println("body: " + body)
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class UserApi(implicit val swagger: Swagger) extends ScalatraServlet
protected implicit val jsonFormats: Formats = DefaultFormats

protected val applicationDescription: String = "UserApi"
override protected val applicationName: Option[String] = Some("User")
override protected val applicationName: Option[String] = Some("/v2/User")

before() {
contentType = formats("json")
Expand Down Expand Up @@ -151,4 +151,4 @@ class UserApi(implicit val swagger: Swagger) extends ScalatraServlet
println("body: " + body)
}

}
}