Various improvements to scala-sttp4 generator (#15931)

* various improvements to scala-sttp4 generator

* test scala with jdk11

* test sttp4 in circleci

* add pom.xml

* update

* update tc
This commit is contained in:
William Cheng 2023-06-27 23:27:38 +08:00 committed by GitHub
parent 7a73f75f70
commit fac04cfa9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 243 additions and 233 deletions

View File

@ -1005,6 +1005,7 @@ Here is a list of template creators:
* Scala (scalaz & http4s): @tbrown1979
* Scala (Akka): @cchafer
* Scala (sttp): @chameleon82
* Scala (sttp4): @flsh86
* Swift: @tkqubo
* Swift 3: @hexelon
* Swift 4: @ehyche
@ -1164,7 +1165,7 @@ If you want to join the committee, please kindly apply by sending an email to te
| R | @Ramanth (2019/07) @saigiridhar21 (2019/07) |
| Ruby | @cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) |
| Rust | @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) @jacob-pro (2022/10) |
| Scala | @clasnake (2017/07), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04) |
| Scala | @clasnake (2017/07), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04) @fish86 (2023/06) |
| Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @4brunu (2019/11) @dydus0x14 (2023/06) |
| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) |
| Xojo | @Topheee (2023/04) |

View File

@ -1,5 +1,5 @@
generatorName: scala-sttp4
outputDir: samples/client/petstore/scala/sttp4
outputDir: samples/client/petstore/scala-sttp4
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/scala-sttp4
additionalProperties:

View File

@ -238,7 +238,7 @@ public class ScalaSttp4ClientCodegen extends AbstractScalaCodegen implements Cod
/**
* Update/clean up model imports
*
* <p>
* append '._" if the import is a Enum class, otherwise
* remove model imports to avoid warnings for importing class in the same package in Scala
*
@ -272,8 +272,7 @@ public class ScalaSttp4ClientCodegen extends AbstractScalaCodegen implements Cod
item.put("import", importPath.concat("._"));
newImports.add(item);
}
}
else {
} else {
item.put("import", importPath);
newImports.add(item);
}
@ -353,8 +352,7 @@ public class ScalaSttp4ClientCodegen extends AbstractScalaCodegen implements Cod
Map<String, String> item = new HashMap<>();
if (isEnumClass(importPath, enumRefs)) {
item.put("import", importPath.concat("._"));
}
else {
} else {
item.put("import", importPath);
}
newImports.add(item);

View File

@ -119,12 +119,14 @@ org.openapitools.codegen.languages.ScalaGatlingCodegen
org.openapitools.codegen.languages.ScalaLagomServerCodegen
org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen
org.openapitools.codegen.languages.ScalaSttpClientCodegen
org.openapitools.codegen.languages.ScalaSttp4ClientCodegen
org.openapitools.codegen.languages.ScalazClientCodegen
org.openapitools.codegen.languages.SpringCodegen
org.openapitools.codegen.languages.StaticDocCodegen
org.openapitools.codegen.languages.StaticHtmlGenerator
org.openapitools.codegen.languages.StaticHtml2Generator
org.openapitools.codegen.languages.Swift5ClientCodegen
org.openapitools.codegen.languages.SwiftCombineClientCodegen
org.openapitools.codegen.languages.TypeScriptClientCodegen
org.openapitools.codegen.languages.TypeScriptAngularClientCodegen
org.openapitools.codegen.languages.TypeScriptAureliaClientCodegen
@ -138,5 +140,3 @@ org.openapitools.codegen.languages.TypeScriptReduxQueryClientCodegen
org.openapitools.codegen.languages.TypeScriptRxjsClientCodegen
org.openapitools.codegen.languages.WsdlSchemaCodegen
org.openapitools.codegen.languages.XojoClientCodegen
org.openapitools.codegen.languages.ScalaSttp4ClientCodegen
org.openapitools.codegen.languages.SwiftCombineClientCodegen

View File

@ -10,8 +10,7 @@ import sttp.model.Method
{{#operations}}
object {{classname}} {
def apply(baseUrl: String = "{{{basePath}}}") = new {{classname}}(baseUrl)
def apply(baseUrl: String = "{{{basePath}}}") = new {{classname}}(baseUrl)
}
class {{classname}}(baseUrl: String) {

View File

@ -1 +1 @@
{{#authMethods.0}}{{#authMethods}}{{#isApiKey}}apiKey: String{{/isApiKey}}{{#isBasic}}{{#isBasicBasic}}username: String, password: String{{/isBasicBasic}}{{#isBasicBearer}}bearerToken: String{{/isBasicBearer}}{{/isBasic}}{{^-last}}, {{/-last}}{{/authMethods}})({{/authMethods.0}}{{#allParams}}{{paramName}}: {{#required}}{{dataType}}{{/required}}{{^required}}{{#isContainer}}{{dataType}}{{/isContainer}}{{^isContainer}}Option[{{dataType}}]{{/isContainer}}{{/required}}{{^defaultValue}}{{^required}}{{^isContainer}} = None{{/isContainer}}{{/required}}{{/defaultValue}}{{^-last}}, {{/-last}}{{/allParams}}
{{#authMethods.0}}{{#authMethods}}{{#isApiKey}}apiKey: String{{/isApiKey}}{{#isBasic}}{{#isBasicBasic}}username: String, password: String{{/isBasicBasic}}{{#isBasicBearer}}bearerToken: String{{/isBasicBearer}}{{/isBasic}}{{^-last}}, {{/-last}}{{/authMethods}})({{/authMethods.0}}{{#allParams}}{{paramName}}: {{#required}}{{dataType}}{{/required}}{{^required}}{{#isContainer}}{{dataType}}{{/isContainer}}{{^isContainer}}Option[{{dataType}}]{{/isContainer}}{{/required}}{{^defaultValue}}{{^required}}{{^isContainer}} = None{{/isContainer}}{{/required}}{{/defaultValue}}{{^-last}}, {{/-last}}{{/allParams}}

View File

@ -2,59 +2,59 @@
package {{package}}
{{#imports}}
import {{import}}
import {{import}}
{{/imports}}
{{#models}}
{{#model}}
{{#description}}
{{#javadocRenderer}}
{{#title}}
{{{.}}}
{{/title}}
{{{description}}}
{{/javadocRenderer}}
{{/description}}
{{^isEnum}}
case class {{classname}}(
{{#vars}}
{{#description}}
/* {{{.}}} */
{{/description}}
{{{name}}}: {{^required}}Option[{{/required}}{{^isEnum}}{{dataType}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}Enums.{{datatypeWithEnum}}{{/isArray}}{{#isArray}}Seq[{{classname}}Enums.{{datatypeWithEnum}}]{{/isArray}}{{/isEnum}}{{^required}}] = None{{/required}}{{^-last}},{{/-last}}
{{/vars}}
)
{{/isEnum}}
{{#model}}
{{#description}}
{{#javadocRenderer}}
{{#title}}
{{{.}}}
{{/title}}
{{{description}}}
{{/javadocRenderer}}
{{/description}}
{{^isEnum}}
case class {{classname}}(
{{#vars}}
{{#description}}
/* {{{.}}} */
{{/description}}
{{{name}}}: {{^required}}Option[{{/required}}{{^isEnum}}{{dataType}}{{/isEnum}}{{#isEnum}}{{^isArray}}{{classname}}Enums.{{datatypeWithEnum}}{{/isArray}}{{#isArray}}Seq[{{classname}}Enums.{{datatypeWithEnum}}]{{/isArray}}{{/isEnum}}{{^required}}] = None{{/required}}{{^-last}},{{/-last}}
{{/vars}}
)
{{/isEnum}}
{{#isEnum}}
object {{classname}} extends Enumeration {
type {{classname}} = {{classname}}.Value
{{#allowableValues}}
{{#values}}
val {{#fnEnumEntry}}{{.}}{{/fnEnumEntry}} = Value("{{.}}")
{{/values}}
{{/allowableValues}}
}
{{/isEnum}}
{{#hasEnums}}
object {{classname}}Enums {
{{#isEnum}}
object {{classname}} extends Enumeration {
type {{classname}} = {{classname}}.Value
{{#allowableValues}}
{{#values}}
val {{#fnEnumEntry}}{{.}}{{/fnEnumEntry}} = Value("{{.}}")
{{/values}}
{{/allowableValues}}
}
{{/isEnum}}
{{#hasEnums}}
object {{classname}}Enums {
{{#vars}}
{{#isEnum}}
type {{datatypeWithEnum}} = {{datatypeWithEnum}}.Value
{{/isEnum}}
{{/vars}}
{{#vars}}
{{#isEnum}}
object {{datatypeWithEnum}} extends Enumeration {
{{#_enum}}
val {{#fnEnumEntry}}{{.}}{{/fnEnumEntry}} = Value("{{.}}")
{{/_enum}}
}
{{#vars}}
{{#isEnum}}
type {{datatypeWithEnum}} = {{datatypeWithEnum}}.Value
{{/isEnum}}
{{/vars}}
{{#vars}}
{{#isEnum}}
object {{datatypeWithEnum}} extends Enumeration {
{{#_enum}}
val {{#fnEnumEntry}}{{.}}{{/fnEnumEntry}} = Value("{{.}}")
{{/_enum}}
}
{{/isEnum}}
{{/vars}}
}
{{/hasEnums}}
{{/model}}
{{/isEnum}}
{{/vars}}
}
{{/hasEnums}}
{{/model}}
{{/models}}

View File

@ -1282,6 +1282,7 @@
<!-- test java-related projects -->
<module>samples/client/petstore/scala-akka</module>
<module>samples/client/petstore/scala-sttp</module>
<module>samples/client/petstore/scala-sttp4</module>
<module>samples/client/petstore/clojure</module>
<module>samples/client/petstore/java/jersey2-java8</module>
<module>samples/openapi3/client/petstore/java/jersey2-java8</module>

View File

@ -0,0 +1,34 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>scala-sttp4-petstore-client</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>scala-sttp4-petstore-client</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>-ivy</argument>
<argument>${user.home}/.ivy2</argument>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -19,8 +19,7 @@ import sttp.client4._
import sttp.model.Method
object PetApi {
def apply(baseUrl: String = "http://petstore.swagger.io/v2") = new PetApi(baseUrl)
def apply(baseUrl: String = "http://petstore.swagger.io/v2") = new PetApi(baseUrl)
}
class PetApi(baseUrl: String) {
@ -34,8 +33,7 @@ class PetApi(baseUrl: String) {
*
* @param pet Pet object that needs to be added to the store
*/
def addPet(pet: Pet
): Request[Either[ResponseException[String, Exception], Pet]] =
def addPet(pet: Pet): Request[Either[ResponseException[String, Exception], Pet]] =
basicRequest
.method(Method.POST, uri"$baseUrl/pet")
.contentType("application/json")
@ -51,8 +49,7 @@ class PetApi(baseUrl: String) {
* @param petId Pet id to delete
* @param apiKey
*/
def deletePet(petId: Long, apiKey: Option[String] = None
): Request[Either[ResponseException[String, Exception], Unit]] =
def deletePet(petId: Long, apiKey: Option[String] = None): Request[Either[ResponseException[String, Exception], Unit]] =
basicRequest
.method(Method.DELETE, uri"$baseUrl/pet/${petId}")
.contentType("application/json")
@ -68,8 +65,7 @@ class PetApi(baseUrl: String) {
*
* @param status Status values that need to be considered for filter
*/
def findPetsByStatus(status: Seq[String]
): Request[Either[ResponseException[String, Exception], Seq[Pet]]] =
def findPetsByStatus(status: Seq[String]): Request[Either[ResponseException[String, Exception], Seq[Pet]]] =
basicRequest
.method(Method.GET, uri"$baseUrl/pet/findByStatus?status=${ status }")
.contentType("application/json")
@ -84,8 +80,7 @@ class PetApi(baseUrl: String) {
*
* @param tags Tags to filter by
*/
def findPetsByTags(tags: Seq[String]
): Request[Either[ResponseException[String, Exception], Seq[Pet]]] =
def findPetsByTags(tags: Seq[String]): Request[Either[ResponseException[String, Exception], Seq[Pet]]] =
basicRequest
.method(Method.GET, uri"$baseUrl/pet/findByTags?tags=${ tags }")
.contentType("application/json")
@ -104,8 +99,7 @@ class PetApi(baseUrl: String) {
*
* @param petId ID of pet to return
*/
def getPetById(apiKey: String)(petId: Long
): Request[Either[ResponseException[String, Exception], Pet]] =
def getPetById(apiKey: String)(petId: Long): Request[Either[ResponseException[String, Exception], Pet]] =
basicRequest
.method(Method.GET, uri"$baseUrl/pet/${petId}")
.contentType("application/json")
@ -123,8 +117,7 @@ class PetApi(baseUrl: String) {
*
* @param pet Pet object that needs to be added to the store
*/
def updatePet(pet: Pet
): Request[Either[ResponseException[String, Exception], Pet]] =
def updatePet(pet: Pet): Request[Either[ResponseException[String, Exception], Pet]] =
basicRequest
.method(Method.PUT, uri"$baseUrl/pet")
.contentType("application/json")
@ -141,8 +134,7 @@ class PetApi(baseUrl: String) {
* @param name Updated name of the pet
* @param status Updated status of the pet
*/
def updatePetWithForm(petId: Long, name: Option[String] = None, status: Option[String] = None
): Request[Either[ResponseException[String, Exception], Unit]] =
def updatePetWithForm(petId: Long, name: Option[String] = None, status: Option[String] = None): Request[Either[ResponseException[String, Exception], Unit]] =
basicRequest
.method(Method.POST, uri"$baseUrl/pet/${petId}")
.contentType("application/x-www-form-urlencoded")
@ -162,8 +154,7 @@ class PetApi(baseUrl: String) {
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
*/
def uploadFile(petId: Long, additionalMetadata: Option[String] = None, file: Option[File] = None
): Request[Either[ResponseException[String, Exception], ApiResponse]] =
def uploadFile(petId: Long, additionalMetadata: Option[String] = None, file: Option[File] = None): Request[Either[ResponseException[String, Exception], ApiResponse]] =
basicRequest
.method(Method.POST, uri"$baseUrl/pet/${petId}/uploadImage")
.contentType("multipart/form-data")

View File

@ -17,8 +17,7 @@ import sttp.client4._
import sttp.model.Method
object StoreApi {
def apply(baseUrl: String = "http://petstore.swagger.io/v2") = new StoreApi(baseUrl)
def apply(baseUrl: String = "http://petstore.swagger.io/v2") = new StoreApi(baseUrl)
}
class StoreApi(baseUrl: String) {
@ -32,8 +31,7 @@ class StoreApi(baseUrl: String) {
*
* @param orderId ID of the order that needs to be deleted
*/
def deleteOrder(orderId: String
): Request[Either[ResponseException[String, Exception], Unit]] =
def deleteOrder(orderId: String): Request[Either[ResponseException[String, Exception], Unit]] =
basicRequest
.method(Method.DELETE, uri"$baseUrl/store/order/${orderId}")
.contentType("application/json")
@ -48,8 +46,7 @@ class StoreApi(baseUrl: String) {
* Available security schemes:
* api_key (apiKey)
*/
def getInventory(apiKey: String)(
): Request[Either[ResponseException[String, Exception], Map[String, Int]]] =
def getInventory(apiKey: String)(): Request[Either[ResponseException[String, Exception], Map[String, Int]]] =
basicRequest
.method(Method.GET, uri"$baseUrl/store/inventory")
.contentType("application/json")
@ -66,8 +63,7 @@ class StoreApi(baseUrl: String) {
*
* @param orderId ID of pet that needs to be fetched
*/
def getOrderById(orderId: Long
): Request[Either[ResponseException[String, Exception], Order]] =
def getOrderById(orderId: Long): Request[Either[ResponseException[String, Exception], Order]] =
basicRequest
.method(Method.GET, uri"$baseUrl/store/order/${orderId}")
.contentType("application/json")
@ -82,8 +78,7 @@ class StoreApi(baseUrl: String) {
*
* @param order order placed for purchasing the pet
*/
def placeOrder(order: Order
): Request[Either[ResponseException[String, Exception], Order]] =
def placeOrder(order: Order): Request[Either[ResponseException[String, Exception], Order]] =
basicRequest
.method(Method.POST, uri"$baseUrl/store/order")
.contentType("application/json")

View File

@ -18,8 +18,7 @@ import sttp.client4._
import sttp.model.Method
object UserApi {
def apply(baseUrl: String = "http://petstore.swagger.io/v2") = new UserApi(baseUrl)
def apply(baseUrl: String = "http://petstore.swagger.io/v2") = new UserApi(baseUrl)
}
class UserApi(baseUrl: String) {
@ -35,8 +34,7 @@ class UserApi(baseUrl: String) {
*
* @param user Created user object
*/
def createUser(apiKey: String)(user: User
): Request[Either[Either[String, String], Unit]] =
def createUser(apiKey: String)(user: User): Request[Either[Either[String, String], Unit]] =
basicRequest
.method(Method.POST, uri"$baseUrl/user")
.contentType("application/json")
@ -55,8 +53,7 @@ class UserApi(baseUrl: String) {
*
* @param user List of user object
*/
def createUsersWithArrayInput(apiKey: String)(user: Seq[User]
): Request[Either[Either[String, String], Unit]] =
def createUsersWithArrayInput(apiKey: String)(user: Seq[User]): Request[Either[Either[String, String], Unit]] =
basicRequest
.method(Method.POST, uri"$baseUrl/user/createWithArray")
.contentType("application/json")
@ -75,8 +72,7 @@ class UserApi(baseUrl: String) {
*
* @param user List of user object
*/
def createUsersWithListInput(apiKey: String)(user: Seq[User]
): Request[Either[Either[String, String], Unit]] =
def createUsersWithListInput(apiKey: String)(user: Seq[User]): Request[Either[Either[String, String], Unit]] =
basicRequest
.method(Method.POST, uri"$baseUrl/user/createWithList")
.contentType("application/json")
@ -96,8 +92,7 @@ class UserApi(baseUrl: String) {
*
* @param username The name that needs to be deleted
*/
def deleteUser(apiKey: String)(username: String
): Request[Either[ResponseException[String, Exception], Unit]] =
def deleteUser(apiKey: String)(username: String): Request[Either[ResponseException[String, Exception], Unit]] =
basicRequest
.method(Method.DELETE, uri"$baseUrl/user/${username}")
.contentType("application/json")
@ -114,8 +109,7 @@ class UserApi(baseUrl: String) {
*
* @param username The name that needs to be fetched. Use user1 for testing.
*/
def getUserByName(username: String
): Request[Either[ResponseException[String, Exception], User]] =
def getUserByName(username: String): Request[Either[ResponseException[String, Exception], User]] =
basicRequest
.method(Method.GET, uri"$baseUrl/user/${username}")
.contentType("application/json")
@ -135,8 +129,7 @@ class UserApi(baseUrl: String) {
* @param username The user name for login
* @param password The password for login in clear text
*/
def loginUser(username: String, password: String
): Request[Either[ResponseException[String, Exception], String]] =
def loginUser(username: String, password: String): Request[Either[ResponseException[String, Exception], String]] =
basicRequest
.method(Method.GET, uri"$baseUrl/user/login?username=${ username }&password=${ password }")
.contentType("application/json")
@ -151,8 +144,7 @@ class UserApi(baseUrl: String) {
* Available security schemes:
* api_key (apiKey)
*/
def logoutUser(apiKey: String)(
): Request[Either[Either[String, String], Unit]] =
def logoutUser(apiKey: String)(): Request[Either[Either[String, String], Unit]] =
basicRequest
.method(Method.GET, uri"$baseUrl/user/logout")
.contentType("application/json")
@ -172,8 +164,7 @@ class UserApi(baseUrl: String) {
* @param username name that need to be deleted
* @param user Updated user object
*/
def updateUser(apiKey: String)(username: String, user: User
): Request[Either[ResponseException[String, Exception], Unit]] =
def updateUser(apiKey: String)(username: String, user: User): Request[Either[ResponseException[String, Exception], Unit]] =
basicRequest
.method(Method.PUT, uri"$baseUrl/user/${username}")
.contentType("application/json")

View File

@ -13,12 +13,12 @@ package org.openapitools.client.model
/**
* An uploaded response
* Describes the result of uploading an image resource
* An uploaded response
* Describes the result of uploading an image resource
*/
case class ApiResponse(
code: Option[Int] = None,
`type`: Option[String] = None,
message: Option[String] = None
)
case class ApiResponse(
code: Option[Int] = None,
`type`: Option[String] = None,
message: Option[String] = None
)

View File

@ -13,11 +13,11 @@ package org.openapitools.client.model
/**
* Pet category
* A category for a pet
* Pet category
* A category for a pet
*/
case class Category(
id: Option[Long] = None,
name: Option[String] = None
)
case class Category(
id: Option[Long] = None,
name: Option[String] = None
)

View File

@ -0,0 +1,39 @@
/**
* 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.time.OffsetDateTime
/**
* Pet Order
* An order for a pets from the pet store
*/
case class Order(
id: Option[Long] = None,
petId: Option[Long] = None,
quantity: Option[Int] = None,
shipDate: Option[OffsetDateTime] = None,
/* Order Status */
status: Option[OrderEnums.Status] = None,
complete: Option[Boolean] = None
)
object OrderEnums {
type Status = Status.Value
object Status extends Enumeration {
val Placed = Value("placed")
val Approved = Value("approved")
val Delivered = Value("delivered")
}
}

View File

@ -0,0 +1,38 @@
/**
* 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
/**
* a Pet
* A pet for sale in the pet store
*/
case class Pet(
id: Option[Long] = None,
category: Option[Category] = None,
name: String,
photoUrls: Seq[String],
tags: Option[Seq[Tag]] = None,
/* pet status in the store */
status: Option[PetEnums.Status] = None
)
object PetEnums {
type Status = Status.Value
object Status extends Enumeration {
val Available = Value("available")
val Pending = Value("pending")
val Sold = Value("sold")
}
}

View File

@ -13,11 +13,11 @@ package org.openapitools.client.model
/**
* Pet Tag
* A tag for a pet
* Pet Tag
* A tag for a pet
*/
case class Tag(
id: Option[Long] = None,
name: Option[String] = None
)
case class Tag(
id: Option[Long] = None,
name: Option[String] = None
)

View File

@ -0,0 +1,30 @@
/**
* 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
/**
* a User
* A User who is purchasing from the pet store
*/
case class User(
id: Option[Long] = None,
username: Option[String] = None,
firstName: Option[String] = None,
lastName: Option[String] = None,
email: Option[String] = None,
password: Option[String] = None,
phone: Option[String] = None,
/* User Status */
userStatus: Option[Int] = None
)

View File

@ -1,39 +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.
*
* 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.time.OffsetDateTime
/**
* Pet Order
* An order for a pets from the pet store
*/
case class Order(
id: Option[Long] = None,
petId: Option[Long] = None,
quantity: Option[Int] = None,
shipDate: Option[OffsetDateTime] = None,
/* Order Status */
status: Option[OrderEnums.Status] = None,
complete: Option[Boolean] = None
)
object OrderEnums {
type Status = Status.Value
object Status extends Enumeration {
val Placed = Value("placed")
val Approved = Value("approved")
val Delivered = Value("delivered")
}
}

View File

@ -1,38 +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.
*
* 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
/**
* a Pet
* A pet for sale in the pet store
*/
case class Pet(
id: Option[Long] = None,
category: Option[Category] = None,
name: String,
photoUrls: Seq[String],
tags: Option[Seq[Tag]] = None,
/* pet status in the store */
status: Option[PetEnums.Status] = None
)
object PetEnums {
type Status = Status.Value
object Status extends Enumeration {
val Available = Value("available")
val Pending = Value("pending")
val Sold = Value("sold")
}
}

View File

@ -1,30 +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.
*
* 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
/**
* a User
* A User who is purchasing from the pet store
*/
case class User(
id: Option[Long] = None,
username: Option[String] = None,
firstName: Option[String] = None,
lastName: Option[String] = None,
email: Option[String] = None,
password: Option[String] = None,
phone: Option[String] = None,
/* User Status */
userStatus: Option[Int] = None
)