forked from loafle/openapi-generator-original
parent
30c2503f9f
commit
b3403015fd
@ -12,7 +12,7 @@ class ScalatraBootstrap extends LifeCycle {
|
|||||||
override def init(context: ServletContext) {
|
override def init(context: ServletContext) {
|
||||||
implicit val system = ActorSystem("appActorSystem")
|
implicit val system = ActorSystem("appActorSystem")
|
||||||
try {
|
try {
|
||||||
{{#apiInfo}}{{#apis}}context mount (new {{classname}}, "/{{baseName}}/*")
|
{{#apiInfo}}{{#apis}}context mount (new {{classname}}, "{{basePathWithoutHost}}/{{baseName}}/*")
|
||||||
{{/apis}}{{/apiInfo}}
|
{{/apis}}{{/apiInfo}}
|
||||||
context mount (new ResourcesApp, "/api-docs/*")
|
context mount (new ResourcesApp, "/api-docs/*")
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -23,7 +23,7 @@ class {{classname}} (implicit val swagger: Swagger) extends ScalatraServlet
|
|||||||
protected implicit val jsonFormats: Formats = DefaultFormats
|
protected implicit val jsonFormats: Formats = DefaultFormats
|
||||||
|
|
||||||
protected val applicationDescription: String = "{{classname}}"
|
protected val applicationDescription: String = "{{classname}}"
|
||||||
override protected val applicationName: Option[String] = Some("{{baseName}}")
|
override protected val applicationName: Option[String] = Some("{{basePathWithoutHost}}/{{baseName}}")
|
||||||
|
|
||||||
before() {
|
before() {
|
||||||
contentType = formats("json")
|
contentType = formats("json")
|
||||||
|
@ -34,9 +34,9 @@ class ScalatraBootstrap extends LifeCycle {
|
|||||||
override def init(context: ServletContext) {
|
override def init(context: ServletContext) {
|
||||||
implicit val system = ActorSystem("appActorSystem")
|
implicit val system = ActorSystem("appActorSystem")
|
||||||
try {
|
try {
|
||||||
context mount (new PetApi, "/Pet/*")
|
context mount (new PetApi, "/v2/Pet/*")
|
||||||
context mount (new StoreApi, "/Store/*")
|
context mount (new StoreApi, "/v2/Store/*")
|
||||||
context mount (new UserApi, "/User/*")
|
context mount (new UserApi, "/v2/User/*")
|
||||||
|
|
||||||
context mount (new ResourcesApp, "/api-docs/*")
|
context mount (new ResourcesApp, "/api-docs/*")
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -46,7 +46,7 @@ class PetApi(implicit val swagger: Swagger) extends ScalatraServlet
|
|||||||
protected implicit val jsonFormats: Formats = DefaultFormats
|
protected implicit val jsonFormats: Formats = DefaultFormats
|
||||||
|
|
||||||
protected val applicationDescription: String = "PetApi"
|
protected val applicationDescription: String = "PetApi"
|
||||||
override protected val applicationName: Option[String] = Some("Pet")
|
override protected val applicationName: Option[String] = Some("/v2/Pet")
|
||||||
|
|
||||||
before() {
|
before() {
|
||||||
contentType = formats("json")
|
contentType = formats("json")
|
||||||
@ -89,7 +89,7 @@ class PetApi(implicit val swagger: Swagger) extends ScalatraServlet
|
|||||||
get("/pet/findByStatus", operation(findPetsByStatusOperation)) {
|
get("/pet/findByStatus", operation(findPetsByStatusOperation)) {
|
||||||
|
|
||||||
val statusString = params.getAs[String]("status")
|
val statusString = params.getAs[String]("status")
|
||||||
val status = if ("csv".equals("default")) {
|
val status = if ("multi".equals("default")) {
|
||||||
statusString match {
|
statusString match {
|
||||||
case Some(str) => str.split(",")
|
case Some(str) => str.split(",")
|
||||||
case None => List()
|
case None => List()
|
||||||
@ -108,7 +108,7 @@ class PetApi(implicit val swagger: Swagger) extends ScalatraServlet
|
|||||||
get("/pet/findByTags", operation(findPetsByTagsOperation)) {
|
get("/pet/findByTags", operation(findPetsByTagsOperation)) {
|
||||||
|
|
||||||
val tagsString = params.getAs[String]("tags")
|
val tagsString = params.getAs[String]("tags")
|
||||||
val tags = if ("csv".equals("default")) {
|
val tags = if ("multi".equals("default")) {
|
||||||
tagsString match {
|
tagsString match {
|
||||||
case Some(str) => str.split(",")
|
case Some(str) => str.split(",")
|
||||||
case None => List()
|
case None => List()
|
||||||
|
@ -44,7 +44,7 @@ class StoreApi(implicit val swagger: Swagger) extends ScalatraServlet
|
|||||||
protected implicit val jsonFormats: Formats = DefaultFormats
|
protected implicit val jsonFormats: Formats = DefaultFormats
|
||||||
|
|
||||||
protected val applicationDescription: String = "StoreApi"
|
protected val applicationDescription: String = "StoreApi"
|
||||||
override protected val applicationName: Option[String] = Some("Store")
|
override protected val applicationName: Option[String] = Some("/v2/Store")
|
||||||
|
|
||||||
before() {
|
before() {
|
||||||
contentType = formats("json")
|
contentType = formats("json")
|
||||||
@ -53,7 +53,7 @@ class StoreApi(implicit val swagger: Swagger) extends ScalatraServlet
|
|||||||
|
|
||||||
val deleteOrderOperation = (apiOperation[Unit]("deleteOrder")
|
val deleteOrderOperation = (apiOperation[Unit]("deleteOrder")
|
||||||
summary "Delete purchase order by ID"
|
summary "Delete purchase order by ID"
|
||||||
parameters (pathParam[String]("orderId").description(""))
|
parameters (pathParam[Long]("orderId").description(""))
|
||||||
)
|
)
|
||||||
|
|
||||||
delete("/store/order/{orderId}", operation(deleteOrderOperation)) {
|
delete("/store/order/{orderId}", operation(deleteOrderOperation)) {
|
||||||
|
@ -44,7 +44,7 @@ class UserApi(implicit val swagger: Swagger) extends ScalatraServlet
|
|||||||
protected implicit val jsonFormats: Formats = DefaultFormats
|
protected implicit val jsonFormats: Formats = DefaultFormats
|
||||||
|
|
||||||
protected val applicationDescription: String = "UserApi"
|
protected val applicationDescription: String = "UserApi"
|
||||||
override protected val applicationName: Option[String] = Some("User")
|
override protected val applicationName: Option[String] = Some("/v2/User")
|
||||||
|
|
||||||
before() {
|
before() {
|
||||||
contentType = formats("json")
|
contentType = formats("json")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user