forked from loafle/openapi-generator-original
Minor enhancements to Scala Play server generator (#2512)
* minor enhancements to openapi-generator * update doc * remove oudated doc
This commit is contained in:
parent
393f5e499e
commit
09d27e82e7
@ -39,7 +39,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
|
||||
| | Languages/Frameworks |
|
||||
|-|-|
|
||||
**API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later), **C++** (cpprest, Qt5, Tizen), **Clojure**, **Dart (1.x, 2.x)**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client), **Kotlin**, **Lua**, **Node.js** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types) **Objective-C**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (rust, rust-server), **Scala** (akka, http4s, scalaz, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x), **Typescript** (AngularJS, Angular (2.x - 7.x), Aurelia, Axios, Fetch, Inversify, jQuery, Node, Rxjs)
|
||||
**Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed), **Erlang**, **Go** (net/http, Gin), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples)), **Kotlin** (Spring Boot, Ktor), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** ([Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), Scalatra)
|
||||
**Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed), **Erlang**, **Go** (net/http, Gin), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples)), **Kotlin** (Spring Boot, Ktor), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** ([Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra)
|
||||
**API documentation generators** | **HTML**, **Confluence Wiki**
|
||||
**Configuration files** | [**Apache2**](https://httpd.apache.org/)
|
||||
**Others** | **GraphQL**, **JMeter**, **MySQL Schema**
|
||||
@ -664,6 +664,7 @@ Here is a list of template creators:
|
||||
* Rust (rust-server): @metaswitch
|
||||
* Scala Finch: @jimschubert [:heart:](https://www.patreon.com/jimschubert)
|
||||
* Scala Lagom: @gmkumar2005
|
||||
* Scala Play: @adigerber
|
||||
* Documentation
|
||||
* HTML Doc 2: @jhitchcock
|
||||
* Confluence Wiki: @jhitchcock
|
||||
|
@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/scala-play-framework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g scala-play-framework -o samples/server/petstore/scala-play-framework $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/scala-play-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g scala-play-server -o samples/server/petstore/scala-play-server $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -5,6 +5,6 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g scala-play-framework -o samples\server\petstore\scala-play-framework
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g scala-play-server -o samples\server\petstore\scala-play-server
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
@ -105,6 +105,7 @@ The following generators are available:
|
||||
- [rust-server](generators/rust-server.md)
|
||||
- [scala-finch](generators/scala-finch.md)
|
||||
- [scala-lagom-server](generators/scala-lagom-server.md)
|
||||
- [scala-play-server](generators/scala-play-server.md)
|
||||
- [scalatra](generators/scalatra.md)
|
||||
- [spring](generators/spring.md)
|
||||
|
||||
|
22
docs/generators/scala-play-server.md
Normal file
22
docs/generators/scala-play-server.md
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
---
|
||||
id: generator-opts-server-scala-play-server
|
||||
title: Config Options for scala-play-server
|
||||
sidebar_label: scala-play-server
|
||||
---
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPackage|package for generated models| |null|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|sourceFolder|source folder for generated code| |null|
|
||||
|routesFileName|Name of the routes file to generate.| |routes|
|
||||
|routesFileName|Base package in which supporting classes are generated.| |org.openapitools|
|
||||
|skipStubs|If set, skips generation of stub classes.| |false|
|
||||
|supportAsync|If set, wraps API return types with Futures and generates async actions.| |false|
|
||||
|generateCustomExceptions|If set, generates custom exception types.| |true|
|
||||
|useSwaggerUI|Add a route to /api which show your documentation in swagger-ui. Will also import needed dependencies| |true|
|
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@ -42,10 +58,10 @@ public class ScalaPlayFrameworkServerCodegen extends AbstractScalaCodegen implem
|
||||
|
||||
public ScalaPlayFrameworkServerCodegen() {
|
||||
super();
|
||||
outputFolder = "generated-code" + File.separator + "scala-play-framework";
|
||||
outputFolder = "generated-code" + File.separator + "scala-play-server";
|
||||
modelTemplateFiles.put("model.mustache", ".scala");
|
||||
apiTemplateFiles.put("api.mustache", ".scala");
|
||||
embeddedTemplateDir = templateDir = "scala-play-framework";
|
||||
embeddedTemplateDir = templateDir = "scala-play-server";
|
||||
hideGenerationTimestamp = false;
|
||||
sourceFolder = "app";
|
||||
apiPackage = "api";
|
||||
@ -81,11 +97,11 @@ public class ScalaPlayFrameworkServerCodegen extends AbstractScalaCodegen implem
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "scala-play-framework";
|
||||
return "scala-play-server";
|
||||
}
|
||||
|
||||
public String getHelp() {
|
||||
return "Generates a Scala server application with Play Framework.";
|
||||
return "Generates a Scala server application (beta) with Play Framework.";
|
||||
}
|
||||
|
||||
public void setSupportAsync(boolean supportAsync) {
|
||||
|
1
pom.xml
1
pom.xml
@ -1152,6 +1152,7 @@
|
||||
<module>samples/server/petstore/jaxrs-cxf-non-spring-app</module>
|
||||
<module>samples/server/petstore/java-msf4j</module>
|
||||
<module>samples/server/petstore/scala-lagom-server</module>
|
||||
<module>samples/server/petstore/scala-play-server</module>
|
||||
<module>samples/server/petstore/scalatra</module>
|
||||
<module>samples/server/petstore/finch</module>
|
||||
<module>samples/server/petstore/kotlin-springboot</module>
|
||||
|
@ -1,55 +0,0 @@
|
||||
# OpenAPI Petstore
|
||||
|
||||
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
|
||||
This Scala Play Framework project was generated by the OpenAPI generator tool at 2019-03-26T02:45:22.426+02:00[Asia/Jerusalem].
|
||||
|
||||
## API
|
||||
|
||||
### Pet
|
||||
|
||||
|Name|Role|
|
||||
|----|----|
|
||||
|`api.PetController`|Play Framework API controller|
|
||||
|`api.PetApi`|Representing trait|
|
||||
|`api.PetApiImpl`|Default implementation|
|
||||
|
||||
* `POST /pet` - Add a new pet to the store
|
||||
* `DELETE /pet/:petId` - Deletes a pet
|
||||
* `GET /pet/findByStatus?status=[value]` - Finds Pets by status
|
||||
* `GET /pet/findByTags?tags=[value]` - Finds Pets by tags
|
||||
* `GET /pet/:petId` - Find pet by ID
|
||||
* `PUT /pet` - Update an existing pet
|
||||
* `POST /pet/:petId` - Updates a pet in the store with form data
|
||||
* `POST /pet/:petId/uploadImage` - uploads an image
|
||||
|
||||
### Store
|
||||
|
||||
|Name|Role|
|
||||
|----|----|
|
||||
|`api.StoreController`|Play Framework API controller|
|
||||
|`api.StoreApi`|Representing trait|
|
||||
|`api.StoreApiImpl`|Default implementation|
|
||||
|
||||
* `DELETE /store/order/:orderId` - Delete purchase order by ID
|
||||
* `GET /store/inventory` - Returns pet inventories by status
|
||||
* `GET /store/order/:orderId` - Find purchase order by ID
|
||||
* `POST /store/order` - Place an order for a pet
|
||||
|
||||
### User
|
||||
|
||||
|Name|Role|
|
||||
|----|----|
|
||||
|`api.UserController`|Play Framework API controller|
|
||||
|`api.UserApi`|Representing trait|
|
||||
|`api.UserApiImpl`|Default implementation|
|
||||
|
||||
* `POST /user` - Create user
|
||||
* `POST /user/createWithArray` - Creates list of users with given input array
|
||||
* `POST /user/createWithList` - Creates list of users with given input array
|
||||
* `DELETE /user/:username` - Delete user
|
||||
* `GET /user/:username` - Get user by user name
|
||||
* `GET /user/login?username=[value]&password=[value]` - Logs user into the system
|
||||
* `GET /user/logout` - Logs out current logged in user session
|
||||
* `PUT /user/:username` - Updated user
|
||||
|
55
samples/server/petstore/scala-play-server/README.md
Normal file
55
samples/server/petstore/scala-play-server/README.md
Normal file
@ -0,0 +1,55 @@
|
||||
# OpenAPI Petstore
|
||||
|
||||
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
|
||||
This Scala Play Framework project was generated by the OpenAPI generator tool at 2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong].
|
||||
|
||||
## API
|
||||
|
||||
### Pet
|
||||
|
||||
|Name|Role|
|
||||
|----|----|
|
||||
|`api.PetController`|Play Framework API controller|
|
||||
|`api.PetApi`|Representing trait|
|
||||
|`api.PetApiImpl`|Default implementation|
|
||||
|
||||
* `POST /v2/pet` - Add a new pet to the store
|
||||
* `DELETE /v2/pet/:petId` - Deletes a pet
|
||||
* `GET /v2/pet/findByStatus?status=[value]` - Finds Pets by status
|
||||
* `GET /v2/pet/findByTags?tags=[value]` - Finds Pets by tags
|
||||
* `GET /v2/pet/:petId` - Find pet by ID
|
||||
* `PUT /v2/pet` - Update an existing pet
|
||||
* `POST /v2/pet/:petId` - Updates a pet in the store with form data
|
||||
* `POST /v2/pet/:petId/uploadImage` - uploads an image
|
||||
|
||||
### Store
|
||||
|
||||
|Name|Role|
|
||||
|----|----|
|
||||
|`api.StoreController`|Play Framework API controller|
|
||||
|`api.StoreApi`|Representing trait|
|
||||
|`api.StoreApiImpl`|Default implementation|
|
||||
|
||||
* `DELETE /v2/store/order/:orderId` - Delete purchase order by ID
|
||||
* `GET /v2/store/inventory` - Returns pet inventories by status
|
||||
* `GET /v2/store/order/:orderId` - Find purchase order by ID
|
||||
* `POST /v2/store/order` - Place an order for a pet
|
||||
|
||||
### User
|
||||
|
||||
|Name|Role|
|
||||
|----|----|
|
||||
|`api.UserController`|Play Framework API controller|
|
||||
|`api.UserApi`|Representing trait|
|
||||
|`api.UserApiImpl`|Default implementation|
|
||||
|
||||
* `POST /v2/user` - Create user
|
||||
* `POST /v2/user/createWithArray` - Creates list of users with given input array
|
||||
* `POST /v2/user/createWithList` - Creates list of users with given input array
|
||||
* `DELETE /v2/user/:username` - Delete user
|
||||
* `GET /v2/user/:username` - Get user by user name
|
||||
* `GET /v2/user/login?username=[value]&password=[value]` - Logs user into the system
|
||||
* `GET /v2/user/logout` - Logs out current logged in user session
|
||||
* `PUT /v2/user/:username` - Updated user
|
||||
|
@ -4,7 +4,7 @@ import model.ApiResponse
|
||||
import model.Pet
|
||||
import play.api.libs.Files.TemporaryFile
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
trait PetApi {
|
||||
/**
|
||||
* Add a new pet to the store
|
@ -8,11 +8,11 @@ import model.ApiResponse
|
||||
import model.Pet
|
||||
import play.api.libs.Files.TemporaryFile
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
@Singleton
|
||||
class PetApiController @Inject()(cc: ControllerComponents, api: PetApi) extends AbstractController(cc) {
|
||||
/**
|
||||
* POST /pet
|
||||
* POST /v2/pet
|
||||
*/
|
||||
def addPet(): Action[AnyContent] = Action { request =>
|
||||
def executeApi(): Unit = {
|
||||
@ -27,7 +27,7 @@ class PetApiController @Inject()(cc: ControllerComponents, api: PetApi) extends
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE /pet/:petId
|
||||
* DELETE /v2/pet/:petId
|
||||
* @param petId Pet id to delete
|
||||
*/
|
||||
def deletePet(petId: Long): Action[AnyContent] = Action { request =>
|
||||
@ -42,7 +42,7 @@ class PetApiController @Inject()(cc: ControllerComponents, api: PetApi) extends
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /pet/findByStatus?status=[value]
|
||||
* GET /v2/pet/findByStatus?status=[value]
|
||||
*/
|
||||
def findPetsByStatus(): Action[AnyContent] = Action { request =>
|
||||
def executeApi(): List[Pet] = {
|
||||
@ -60,7 +60,7 @@ class PetApiController @Inject()(cc: ControllerComponents, api: PetApi) extends
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /pet/findByTags?tags=[value]
|
||||
* GET /v2/pet/findByTags?tags=[value]
|
||||
*/
|
||||
def findPetsByTags(): Action[AnyContent] = Action { request =>
|
||||
def executeApi(): List[Pet] = {
|
||||
@ -78,7 +78,7 @@ class PetApiController @Inject()(cc: ControllerComponents, api: PetApi) extends
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /pet/:petId
|
||||
* GET /v2/pet/:petId
|
||||
* @param petId ID of pet to return
|
||||
*/
|
||||
def getPetById(petId: Long): Action[AnyContent] = Action { request =>
|
||||
@ -92,7 +92,7 @@ class PetApiController @Inject()(cc: ControllerComponents, api: PetApi) extends
|
||||
}
|
||||
|
||||
/**
|
||||
* PUT /pet
|
||||
* PUT /v2/pet
|
||||
*/
|
||||
def updatePet(): Action[AnyContent] = Action { request =>
|
||||
def executeApi(): Unit = {
|
||||
@ -107,7 +107,7 @@ class PetApiController @Inject()(cc: ControllerComponents, api: PetApi) extends
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /pet/:petId
|
||||
* POST /v2/pet/:petId
|
||||
* @param petId ID of pet that needs to be updated
|
||||
*/
|
||||
def updatePetWithForm(petId: Long): Action[AnyContent] = Action { request =>
|
||||
@ -128,7 +128,7 @@ class PetApiController @Inject()(cc: ControllerComponents, api: PetApi) extends
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /pet/:petId/uploadImage
|
||||
* POST /v2/pet/:petId/uploadImage
|
||||
* @param petId ID of pet to update
|
||||
*/
|
||||
def uploadFile(petId: Long): Action[AnyContent] = Action { request =>
|
@ -7,7 +7,7 @@ import play.api.libs.Files.TemporaryFile
|
||||
/**
|
||||
* Provides a default implementation for [[PetApi]].
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
class PetApiImpl extends PetApi {
|
||||
/**
|
||||
* @inheritdoc
|
@ -2,7 +2,7 @@ package api
|
||||
|
||||
import model.Order
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
trait StoreApi {
|
||||
/**
|
||||
* Delete purchase order by ID
|
@ -6,11 +6,11 @@ import play.api.libs.json._
|
||||
import play.api.mvc._
|
||||
import model.Order
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
@Singleton
|
||||
class StoreApiController @Inject()(cc: ControllerComponents, api: StoreApi) extends AbstractController(cc) {
|
||||
/**
|
||||
* DELETE /store/order/:orderId
|
||||
* DELETE /v2/store/order/:orderId
|
||||
* @param orderId ID of the order that needs to be deleted
|
||||
*/
|
||||
def deleteOrder(orderId: String): Action[AnyContent] = Action { request =>
|
||||
@ -23,7 +23,7 @@ class StoreApiController @Inject()(cc: ControllerComponents, api: StoreApi) exte
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /store/inventory
|
||||
* GET /v2/store/inventory
|
||||
*/
|
||||
def getInventory(): Action[AnyContent] = Action { request =>
|
||||
def executeApi(): Map[String, Int] = {
|
||||
@ -36,7 +36,7 @@ class StoreApiController @Inject()(cc: ControllerComponents, api: StoreApi) exte
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /store/order/:orderId
|
||||
* GET /v2/store/order/:orderId
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
*/
|
||||
def getOrderById(orderId: Long): Action[AnyContent] = Action { request =>
|
||||
@ -50,7 +50,7 @@ class StoreApiController @Inject()(cc: ControllerComponents, api: StoreApi) exte
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /store/order
|
||||
* POST /v2/store/order
|
||||
*/
|
||||
def placeOrder(): Action[AnyContent] = Action { request =>
|
||||
def executeApi(): Order = {
|
@ -5,7 +5,7 @@ import model.Order
|
||||
/**
|
||||
* Provides a default implementation for [[StoreApi]].
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
class StoreApiImpl extends StoreApi {
|
||||
/**
|
||||
* @inheritdoc
|
@ -2,7 +2,7 @@ package api
|
||||
|
||||
import model.User
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
trait UserApi {
|
||||
/**
|
||||
* Create user
|
@ -6,11 +6,11 @@ import play.api.libs.json._
|
||||
import play.api.mvc._
|
||||
import model.User
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
@Singleton
|
||||
class UserApiController @Inject()(cc: ControllerComponents, api: UserApi) extends AbstractController(cc) {
|
||||
/**
|
||||
* POST /user
|
||||
* POST /v2/user
|
||||
*/
|
||||
def createUser(): Action[AnyContent] = Action { request =>
|
||||
def executeApi(): Unit = {
|
||||
@ -25,7 +25,7 @@ class UserApiController @Inject()(cc: ControllerComponents, api: UserApi) extend
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /user/createWithArray
|
||||
* POST /v2/user/createWithArray
|
||||
*/
|
||||
def createUsersWithArrayInput(): Action[AnyContent] = Action { request =>
|
||||
def executeApi(): Unit = {
|
||||
@ -40,7 +40,7 @@ class UserApiController @Inject()(cc: ControllerComponents, api: UserApi) extend
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /user/createWithList
|
||||
* POST /v2/user/createWithList
|
||||
*/
|
||||
def createUsersWithListInput(): Action[AnyContent] = Action { request =>
|
||||
def executeApi(): Unit = {
|
||||
@ -55,7 +55,7 @@ class UserApiController @Inject()(cc: ControllerComponents, api: UserApi) extend
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE /user/:username
|
||||
* DELETE /v2/user/:username
|
||||
* @param username The name that needs to be deleted
|
||||
*/
|
||||
def deleteUser(username: String): Action[AnyContent] = Action { request =>
|
||||
@ -68,7 +68,7 @@ class UserApiController @Inject()(cc: ControllerComponents, api: UserApi) extend
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /user/:username
|
||||
* GET /v2/user/:username
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
*/
|
||||
def getUserByName(username: String): Action[AnyContent] = Action { request =>
|
||||
@ -82,7 +82,7 @@ class UserApiController @Inject()(cc: ControllerComponents, api: UserApi) extend
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /user/login?username=[value]&password=[value]
|
||||
* GET /v2/user/login?username=[value]&password=[value]
|
||||
*/
|
||||
def loginUser(): Action[AnyContent] = Action { request =>
|
||||
def executeApi(): String = {
|
||||
@ -103,7 +103,7 @@ class UserApiController @Inject()(cc: ControllerComponents, api: UserApi) extend
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /user/logout
|
||||
* GET /v2/user/logout
|
||||
*/
|
||||
def logoutUser(): Action[AnyContent] = Action { request =>
|
||||
def executeApi(): Unit = {
|
||||
@ -115,7 +115,7 @@ class UserApiController @Inject()(cc: ControllerComponents, api: UserApi) extend
|
||||
}
|
||||
|
||||
/**
|
||||
* PUT /user/:username
|
||||
* PUT /v2/user/:username
|
||||
* @param username name that need to be deleted
|
||||
*/
|
||||
def updateUser(username: String): Action[AnyContent] = Action { request =>
|
@ -5,7 +5,7 @@ import model.User
|
||||
/**
|
||||
* Provides a default implementation for [[UserApi]].
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
class UserApiImpl extends UserApi {
|
||||
/**
|
||||
* @inheritdoc
|
@ -5,7 +5,7 @@ import play.api.libs.json._
|
||||
/**
|
||||
* Describes the result of uploading an image resource
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
case class ApiResponse(
|
||||
code: Option[Int],
|
||||
`type`: Option[String],
|
@ -5,7 +5,7 @@ import play.api.libs.json._
|
||||
/**
|
||||
* A category for a pet
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
case class Category(
|
||||
id: Option[Long],
|
||||
name: Option[String]
|
@ -7,7 +7,7 @@ import java.time.OffsetDateTime
|
||||
* An order for a pets from the pet store
|
||||
* @param status Order Status
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
case class Order(
|
||||
id: Option[Long],
|
||||
petId: Option[Long],
|
@ -6,7 +6,7 @@ import play.api.libs.json._
|
||||
* A pet for sale in the pet store
|
||||
* @param status pet status in the store
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
case class Pet(
|
||||
id: Option[Long],
|
||||
category: Option[Category],
|
@ -5,7 +5,7 @@ import play.api.libs.json._
|
||||
/**
|
||||
* A tag for a pet
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
case class Tag(
|
||||
id: Option[Long],
|
||||
name: Option[String]
|
@ -6,7 +6,7 @@ import play.api.libs.json._
|
||||
* A User who is purchasing from the pet store
|
||||
* @param userStatus User Status
|
||||
*/
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
case class User(
|
||||
id: Option[Long],
|
||||
username: Option[String],
|
@ -4,7 +4,7 @@ import api._
|
||||
import play.api.inject.{Binding, Module => PlayModule}
|
||||
import play.api.{Configuration, Environment}
|
||||
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T02:45:22.426+02:00[Asia/Jerusalem]")
|
||||
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
|
||||
class Module extends PlayModule {
|
||||
override def bindings(environment: Environment, configuration: Configuration): Seq[Binding[_]] = Seq(
|
||||
bind[PetApi].to[PetApiImpl],
|
32
samples/server/petstore/scala-play-server/pom.xml
Normal file
32
samples/server/petstore/scala-play-server/pom.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>scala-play-server</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Scala Play server</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.5.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sbt-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>sbt</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -112,8 +112,8 @@
|
||||
"type" : "array",
|
||||
"items" : {
|
||||
"type" : "string",
|
||||
"enum" : [ "available", "pending", "sold" ],
|
||||
"default" : "available"
|
||||
"default" : "available",
|
||||
"enum" : [ "available", "pending", "sold" ]
|
||||
}
|
||||
}
|
||||
} ],
|
Loading…
x
Reference in New Issue
Block a user