Migrate all scala generators to use OAS3 (#6407)

* migrate all scala generators to use oas3

* add back pom.xml for scala-sttp

* skip form model in scalaz

* fix scala lagom tests

* add new files

* skip form models in scala finch petstore

* update samples
This commit is contained in:
William Cheng
2020-05-25 23:09:34 +08:00
committed by GitHub
parent db4c4917e2
commit 6abc4fdab2
95 changed files with 1194 additions and 1715 deletions

View File

@@ -80,11 +80,11 @@ class PetApi(
* Add a new pet to the store
*
*
* @param body Pet object that needs to be added to the store
* @return void
* @param pet Pet object that needs to be added to the store
* @return Pet
*/
def addPet(body: Pet) = {
val await = Try(Await.result(addPetAsync(body), Duration.Inf))
def addPet(pet: Pet): Option[Pet] = {
val await = Try(Await.result(addPetAsync(pet), Duration.Inf))
await match {
case Success(i) => Some(await.get)
case Failure(t) => None
@@ -95,11 +95,11 @@ class PetApi(
* Add a new pet to the store asynchronously
*
*
* @param body Pet object that needs to be added to the store
* @return Future(void)
* @param pet Pet object that needs to be added to the store
* @return Future(Pet)
*/
def addPetAsync(body: Pet) = {
helper.addPet(body)
def addPetAsync(pet: Pet): Future[Pet] = {
helper.addPet(pet)
}
/**
@@ -212,11 +212,11 @@ class PetApi(
* Update an existing pet
*
*
* @param body Pet object that needs to be added to the store
* @return void
* @param pet Pet object that needs to be added to the store
* @return Pet
*/
def updatePet(body: Pet) = {
val await = Try(Await.result(updatePetAsync(body), Duration.Inf))
def updatePet(pet: Pet): Option[Pet] = {
val await = Try(Await.result(updatePetAsync(pet), Duration.Inf))
await match {
case Success(i) => Some(await.get)
case Failure(t) => None
@@ -227,11 +227,11 @@ class PetApi(
* Update an existing pet asynchronously
*
*
* @param body Pet object that needs to be added to the store
* @return Future(void)
* @param pet Pet object that needs to be added to the store
* @return Future(Pet)
*/
def updatePetAsync(body: Pet) = {
helper.updatePet(body)
def updatePetAsync(pet: Pet): Future[Pet] = {
helper.updatePet(pet)
}
/**
@@ -298,7 +298,7 @@ class PetApi(
class PetApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
def addPet(body: Pet)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
def addPet(pet: Pet)(implicit reader: ClientResponseReader[Pet], writer: RequestWriter[Pet]): Future[Pet] = {
// create path and map variables
val path = (addFmt("/pet"))
@@ -306,9 +306,9 @@ class PetApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends
val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String]
if (body == null) throw new Exception("Missing required parameter 'body' when calling PetApi->addPet")
if (pet == null) throw new Exception("Missing required parameter 'pet' when calling PetApi->addPet")
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(pet))
resFuture flatMap { resp =>
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
@@ -406,7 +406,7 @@ class PetApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends
}
}
def updatePet(body: Pet)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[Pet]): Future[Unit] = {
def updatePet(pet: Pet)(implicit reader: ClientResponseReader[Pet], writer: RequestWriter[Pet]): Future[Pet] = {
// create path and map variables
val path = (addFmt("/pet"))
@@ -414,9 +414,9 @@ class PetApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends
val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String]
if (body == null) throw new Exception("Missing required parameter 'body' when calling PetApi->updatePet")
if (pet == null) throw new Exception("Missing required parameter 'pet' when calling PetApi->updatePet")
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(pet))
resFuture flatMap { resp =>
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {

View File

@@ -154,11 +154,11 @@ class StoreApi(
* Place an order for a pet
*
*
* @param body order placed for purchasing the pet
* @param order order placed for purchasing the pet
* @return Order
*/
def placeOrder(body: Order): Option[Order] = {
val await = Try(Await.result(placeOrderAsync(body), Duration.Inf))
def placeOrder(order: Order): Option[Order] = {
val await = Try(Await.result(placeOrderAsync(order), Duration.Inf))
await match {
case Success(i) => Some(await.get)
case Failure(t) => None
@@ -169,11 +169,11 @@ class StoreApi(
* Place an order for a pet asynchronously
*
*
* @param body order placed for purchasing the pet
* @param order order placed for purchasing the pet
* @return Future(Order)
*/
def placeOrderAsync(body: Order): Future[Order] = {
helper.placeOrder(body)
def placeOrderAsync(order: Order): Future[Order] = {
helper.placeOrder(order)
}
}
@@ -241,7 +241,7 @@ class StoreApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extend
}
}
def placeOrder(body: Order)(implicit reader: ClientResponseReader[Order], writer: RequestWriter[Order]): Future[Order] = {
def placeOrder(order: Order)(implicit reader: ClientResponseReader[Order], writer: RequestWriter[Order]): Future[Order] = {
// create path and map variables
val path = (addFmt("/store/order"))
@@ -249,9 +249,9 @@ class StoreApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extend
val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String]
if (body == null) throw new Exception("Missing required parameter 'body' when calling StoreApi->placeOrder")
if (order == null) throw new Exception("Missing required parameter 'order' when calling StoreApi->placeOrder")
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(order))
resFuture flatMap { resp =>
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {

View File

@@ -78,11 +78,11 @@ class UserApi(
* Create user
* This can only be done by the logged in user.
*
* @param body Created user object
* @param user Created user object
* @return void
*/
def createUser(body: User) = {
val await = Try(Await.result(createUserAsync(body), Duration.Inf))
def createUser(user: User) = {
val await = Try(Await.result(createUserAsync(user), Duration.Inf))
await match {
case Success(i) => Some(await.get)
case Failure(t) => None
@@ -93,22 +93,22 @@ class UserApi(
* Create user asynchronously
* This can only be done by the logged in user.
*
* @param body Created user object
* @param user Created user object
* @return Future(void)
*/
def createUserAsync(body: User) = {
helper.createUser(body)
def createUserAsync(user: User) = {
helper.createUser(user)
}
/**
* Creates list of users with given input array
*
*
* @param body List of user object
* @param user List of user object
* @return void
*/
def createUsersWithArrayInput(body: List[User]) = {
val await = Try(Await.result(createUsersWithArrayInputAsync(body), Duration.Inf))
def createUsersWithArrayInput(user: List[User]) = {
val await = Try(Await.result(createUsersWithArrayInputAsync(user), Duration.Inf))
await match {
case Success(i) => Some(await.get)
case Failure(t) => None
@@ -119,22 +119,22 @@ class UserApi(
* Creates list of users with given input array asynchronously
*
*
* @param body List of user object
* @param user List of user object
* @return Future(void)
*/
def createUsersWithArrayInputAsync(body: List[User]) = {
helper.createUsersWithArrayInput(body)
def createUsersWithArrayInputAsync(user: List[User]) = {
helper.createUsersWithArrayInput(user)
}
/**
* Creates list of users with given input array
*
*
* @param body List of user object
* @param user List of user object
* @return void
*/
def createUsersWithListInput(body: List[User]) = {
val await = Try(Await.result(createUsersWithListInputAsync(body), Duration.Inf))
def createUsersWithListInput(user: List[User]) = {
val await = Try(Await.result(createUsersWithListInputAsync(user), Duration.Inf))
await match {
case Success(i) => Some(await.get)
case Failure(t) => None
@@ -145,11 +145,11 @@ class UserApi(
* Creates list of users with given input array asynchronously
*
*
* @param body List of user object
* @param user List of user object
* @return Future(void)
*/
def createUsersWithListInputAsync(body: List[User]) = {
helper.createUsersWithListInput(body)
def createUsersWithListInputAsync(user: List[User]) = {
helper.createUsersWithListInput(user)
}
/**
@@ -261,11 +261,11 @@ class UserApi(
* This can only be done by the logged in user.
*
* @param username name that need to be deleted
* @param body Updated user object
* @param user Updated user object
* @return void
*/
def updateUser(username: String, body: User) = {
val await = Try(Await.result(updateUserAsync(username, body), Duration.Inf))
def updateUser(username: String, user: User) = {
val await = Try(Await.result(updateUserAsync(username, user), Duration.Inf))
await match {
case Success(i) => Some(await.get)
case Failure(t) => None
@@ -277,18 +277,18 @@ class UserApi(
* This can only be done by the logged in user.
*
* @param username name that need to be deleted
* @param body Updated user object
* @param user Updated user object
* @return Future(void)
*/
def updateUserAsync(username: String, body: User) = {
helper.updateUser(username, body)
def updateUserAsync(username: String, user: User) = {
helper.updateUser(username, user)
}
}
class UserApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends ApiClient(client, config) {
def createUser(body: User)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
def createUser(user: User)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
// create path and map variables
val path = (addFmt("/user"))
@@ -296,9 +296,9 @@ class UserApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends
val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String]
if (body == null) throw new Exception("Missing required parameter 'body' when calling UserApi->createUser")
if (user == null) throw new Exception("Missing required parameter 'user' when calling UserApi->createUser")
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(user))
resFuture flatMap { resp =>
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
@@ -308,7 +308,7 @@ class UserApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends
}
}
def createUsersWithArrayInput(body: List[User])(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
def createUsersWithArrayInput(user: List[User])(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
// create path and map variables
val path = (addFmt("/user/createWithArray"))
@@ -316,9 +316,9 @@ class UserApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends
val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String]
if (body == null) throw new Exception("Missing required parameter 'body' when calling UserApi->createUsersWithArrayInput")
if (user == null) throw new Exception("Missing required parameter 'user' when calling UserApi->createUsersWithArrayInput")
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(user))
resFuture flatMap { resp =>
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
@@ -328,7 +328,7 @@ class UserApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends
}
}
def createUsersWithListInput(body: List[User])(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
def createUsersWithListInput(user: List[User])(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[List[User]]): Future[Unit] = {
// create path and map variables
val path = (addFmt("/user/createWithList"))
@@ -336,9 +336,9 @@ class UserApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends
val queryParams = new mutable.HashMap[String, String]
val headerParams = new mutable.HashMap[String, String]
if (body == null) throw new Exception("Missing required parameter 'body' when calling UserApi->createUsersWithListInput")
if (user == null) throw new Exception("Missing required parameter 'user' when calling UserApi->createUsersWithListInput")
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(body))
val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(user))
resFuture flatMap { resp =>
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
@@ -438,7 +438,7 @@ class UserApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends
}
def updateUser(username: String,
body: User)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
user: User)(implicit reader: ClientResponseReader[Unit], writer: RequestWriter[User]): Future[Unit] = {
// create path and map variables
val path = (addFmt("/user/{username}")
replaceAll("\\{" + "username" + "\\}", username.toString))
@@ -449,9 +449,9 @@ class UserApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends
if (username == null) throw new Exception("Missing required parameter 'username' when calling UserApi->updateUser")
if (body == null) throw new Exception("Missing required parameter 'body' when calling UserApi->updateUser")
if (user == null) throw new Exception("Missing required parameter 'user' when calling UserApi->updateUser")
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(body))
val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(user))
resFuture flatMap { resp =>
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {

View File

@@ -0,0 +1,22 @@
/**
* 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.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model
case class InlineObject (
// Updated name of the pet
name: Option[String] = None,
// Updated status of the pet
status: Option[String] = None
)

View File

@@ -0,0 +1,23 @@
/**
* 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.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model
import java.io.File
case class InlineObject1 (
// Additional data to pass to server
additionalMetadata: Option[String] = None,
// file to upload
file: Option[File] = None
)