diff --git a/samples/server-generator/scalatra/ScalatraServerGenerator.scala b/samples/server-generator/scalatra/ScalatraServerGenerator.scala index e63d61e47e9..e139b8df07d 100644 --- a/samples/server-generator/scalatra/ScalatraServerGenerator.scala +++ b/samples/server-generator/scalatra/ScalatraServerGenerator.scala @@ -61,7 +61,7 @@ object ScalatraServerGenerator extends BasicScalaGenerator { val path = { val arr = k._2.toString.split("/") if (arr.length >= 2) { - mutable += "basePart" -> k._2 + mutable += "basePart" -> (arr.slice(2, arr.length).mkString("", "/", "")) "/" + arr.slice(2, arr.length).mkString("", "/", "") } else k._2.toString diff --git a/samples/server-generator/scalatra/output/src/main/scala/apis/PetApi.scala b/samples/server-generator/scalatra/output/src/main/scala/apis/PetApi.scala index ec7d8fd652a..06cbb835222 100644 --- a/samples/server-generator/scalatra/output/src/main/scala/apis/PetApi.scala +++ b/samples/server-generator/scalatra/output/src/main/scala/apis/PetApi.scala @@ -14,7 +14,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagge summary("Find pet by ID"), nickname("getPetById"), responseClass("Pet"), - endpoint("/pet.{format}/{petId}"), + endpoint("{petId}"), notes("Returns a pet based on ID"), parameters( Parameter("petId", "ID of pet that needs to be fetched", @@ -28,7 +28,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagge summary("Add a new pet to the store"), nickname("addPet"), responseClass("void"), - endpoint("/pet.{format}"), + endpoint(""), notes(""), parameters( Parameter("body", "Pet object that needs to be added to the store", @@ -42,7 +42,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagge summary("Update an existing pet"), nickname("updatePet"), responseClass("void"), - endpoint("/pet.{format}"), + endpoint(""), notes(""), parameters( Parameter("body", "Pet object that needs to be updated in the store", @@ -56,7 +56,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagge summary("Finds Pets by status"), nickname("findPetsByStatus"), responseClass("List[Pet]"), - endpoint("/pet.{format}/findByStatus"), + endpoint("findByStatus"), notes("Multiple status values can be provided with comma seperated strings"), parameters( Parameter("status", "Status values that need to be considered for filter", @@ -73,7 +73,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagge summary("Finds Pets by tags"), nickname("findPetsByTags"), responseClass("List[Pet]"), - endpoint("/pet.{format}/findByTags"), + endpoint("findByTags"), notes("Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing."), parameters( Parameter("tags", "Tags to filter by", diff --git a/samples/server-generator/scalatra/output/src/main/scala/apis/StoreApi.scala b/samples/server-generator/scalatra/output/src/main/scala/apis/StoreApi.scala index cfe12a57c23..6afff957121 100644 --- a/samples/server-generator/scalatra/output/src/main/scala/apis/StoreApi.scala +++ b/samples/server-generator/scalatra/output/src/main/scala/apis/StoreApi.scala @@ -14,7 +14,7 @@ class StoreApi (implicit val swagger: Swagger) extends ScalatraServlet with Swag summary("Find purchase order by ID"), nickname("getOrderById"), responseClass("Order"), - endpoint("/store.{format}/order/{orderId}"), + endpoint("order/{orderId}"), notes("For valid response try integer IDs with value <= 5. Anything above 5 or nonintegers will generate API errors"), parameters( Parameter("orderId", "ID of pet that needs to be fetched", @@ -28,7 +28,7 @@ class StoreApi (implicit val swagger: Swagger) extends ScalatraServlet with Swag summary("Delete purchase order by ID"), nickname("deleteOrder"), responseClass("void"), - endpoint("/store.{format}/order/{orderId}"), + endpoint("order/{orderId}"), notes("For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors"), parameters( Parameter("orderId", "ID of the order that needs to be deleted", @@ -42,7 +42,7 @@ class StoreApi (implicit val swagger: Swagger) extends ScalatraServlet with Swag summary("Place an order for a pet"), nickname("placeOrder"), responseClass("void"), - endpoint("/store.{format}/order"), + endpoint("order"), notes(""), parameters( Parameter("body", "order placed for purchasing the pet", diff --git a/samples/server-generator/scalatra/output/src/main/scala/apis/UserApi.scala b/samples/server-generator/scalatra/output/src/main/scala/apis/UserApi.scala index c986f3425b8..74a8121061c 100644 --- a/samples/server-generator/scalatra/output/src/main/scala/apis/UserApi.scala +++ b/samples/server-generator/scalatra/output/src/main/scala/apis/UserApi.scala @@ -14,7 +14,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagg summary("Creates list of users with given input array"), nickname("createUsersWithArrayInput"), responseClass("void"), - endpoint("/user.{format}/createWithArray"), + endpoint("createWithArray"), notes(""), parameters( Parameter("body", "List of user object", @@ -28,7 +28,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagg summary("Create user"), nickname("createUser"), responseClass("void"), - endpoint("/user.{format}"), + endpoint(""), notes("This can only be done by the logged in user."), parameters( Parameter("body", "Created user object", @@ -42,7 +42,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagg summary("Creates list of users with given list input"), nickname("createUsersWithListInput"), responseClass("void"), - endpoint("/user.{format}/createWithList"), + endpoint("createWithList"), notes(""), parameters( Parameter("body", "List of user object", @@ -56,7 +56,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagg summary("Updated user"), nickname("updateUser"), responseClass("void"), - endpoint("/user.{format}/{username}"), + endpoint("{username}"), notes("This can only be done by the logged in user."), parameters( Parameter("username", "name that need to be deleted", @@ -74,7 +74,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagg summary("Delete user"), nickname("deleteUser"), responseClass("void"), - endpoint("/user.{format}/{username}"), + endpoint("{username}"), notes("This can only be done by the logged in user."), parameters( Parameter("username", "The name that needs to be deleted", @@ -88,7 +88,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagg summary("Get user by user name"), nickname("getUserByName"), responseClass("User"), - endpoint("/user.{format}/{username}"), + endpoint("{username}"), notes(""), parameters( Parameter("username", "The name that needs to be fetched. Use user1 for testing.", @@ -102,7 +102,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagg summary("Logs user into the system"), nickname("loginUser"), responseClass("String"), - endpoint("/user.{format}/login"), + endpoint("login"), notes(""), parameters( Parameter("username", "The user name for login", @@ -126,7 +126,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet with Swagg summary("Logs out current logged in user session"), nickname("logoutUser"), responseClass("void"), - endpoint("/user.{format}/logout"), + endpoint("logout"), notes(""), parameters( )) {