[kotlin-spring] Adding DocumentationProvider and SwaggerUI (#12184)

* Adding DocumentationProvider and SwaggerUI to Kotlin Spring

* Fixing annotation errors

* Fixes to homeController

* Minor stylistic fixes

* Removing parameter from docs

* Structuring pom, making gradle file similar to pom

* Updating samples
This commit is contained in:
Johan Sjöblom
2022-04-26 17:03:32 +00:00
committed by GitHub
parent 074010e124
commit 356732d1bd
211 changed files with 11950 additions and 1338 deletions

View File

@@ -30,14 +30,17 @@ plugins {
}
dependencies {
val kotlinxCoroutinesVersion="1.2.0"
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
compile("org.jetbrains.kotlin:kotlin-reflect")
compile("org.springframework.boot:spring-boot-starter-web")
compile("io.swagger:swagger-annotations:1.5.21")
compile("com.google.code.findbugs:jsr305:3.0.2")
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
compile("com.fasterxml.jackson.module:jackson-module-kotlin")
compile("jakarta.validation:jakarta.validation-api")
compile("jakarta.annotation:jakarta.annotation-api:1.3.5")
testCompile("org.jetbrains.kotlin:kotlin-test-junit5")
testCompile("org.springframework.boot:spring-boot-starter-test") {

View File

@@ -6,10 +6,12 @@
<name>openapi-spring</name>
<version>1.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<findbugs-jsr305.version>3.0.2</findbugs-jsr305.version>
<jakarta-annotation.version>1.3.5</jakarta-annotation.version>
<kotlin-test-junit5.version>1.3.31</kotlin-test-junit5.version>
<kotlin.version>1.3.30</kotlin.version>
<kotlinx-coroutines.version>1.2.0</kotlinx-coroutines.version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
@@ -83,16 +85,13 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.21</version>
</dependency>
<!-- @Nullable annotation -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<version>${findbugs-jsr305.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
@@ -118,13 +117,13 @@
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<version>${jakarta-annotation.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit5</artifactId>
<version>1.3.31</version>
<version>${kotlin-test-junit5.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@@ -1,9 +1,8 @@
package org.openapitools
import org.springframework.boot.runApplication
import org.springframework.context.annotation.ComponentScan
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.context.annotation.ComponentScan
@SpringBootApplication
@ComponentScan(basePackages = ["org.openapitools", "org.openapitools.api", "org.openapitools.model"])

View File

@@ -2,13 +2,6 @@ package org.openapitools.api
import org.openapitools.model.ModelApiResponse
import org.openapitools.model.Pet
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import io.swagger.annotations.ApiResponse
import io.swagger.annotations.ApiResponses
import io.swagger.annotations.Authorization
import io.swagger.annotations.AuthorizationScope
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
@@ -33,154 +26,86 @@ import kotlin.collections.Map
@RestController
@Validated
@Api(value = "pet", description = "The pet API")
@RequestMapping("\${api.base-path:/v2}")
class PetApiController(@Autowired(required = true) val service: PetApiService) {
@ApiOperation(
value = "Add a new pet to the store",
nickname = "addPet",
notes = "",
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
@ApiResponses(
value = [ApiResponse(code = 405, message = "Invalid input")])
@RequestMapping(
method = [RequestMethod.POST],
value = ["/pet"],
consumes = ["application/json", "application/xml"]
)
fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet
): ResponseEntity<Unit> {
fun addPet( @Valid @RequestBody body: Pet): ResponseEntity<Unit> {
return ResponseEntity(service.addPet(body), HttpStatus.valueOf(405))
}
@ApiOperation(
value = "Deletes a pet",
nickname = "deletePet",
notes = "",
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
@ApiResponses(
value = [ApiResponse(code = 400, message = "Invalid pet value")])
@RequestMapping(
method = [RequestMethod.DELETE],
value = ["/pet/{petId}"]
)
fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: kotlin.Long
,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: kotlin.String?
): ResponseEntity<Unit> {
fun deletePet( @PathVariable("petId") petId: kotlin.Long, @RequestHeader(value = "api_key", required = false) apiKey: kotlin.String?): ResponseEntity<Unit> {
return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.valueOf(400))
}
@ApiOperation(
value = "Finds Pets by status",
nickname = "findPetsByStatus",
notes = "Multiple status values can be provided with comma separated strings",
response = Pet::class,
responseContainer = "List",
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")])
@RequestMapping(
method = [RequestMethod.GET],
value = ["/pet/findByStatus"],
produces = ["application/xml", "application/json"]
)
fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List<kotlin.String>
): ResponseEntity<List<Pet>> {
fun findPetsByStatus(@NotNull @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List<kotlin.String>): ResponseEntity<List<Pet>> {
return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200))
}
@ApiOperation(
value = "Finds Pets by tags",
nickname = "findPetsByTags",
notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
response = Pet::class,
responseContainer = "List",
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")])
@RequestMapping(
method = [RequestMethod.GET],
value = ["/pet/findByTags"],
produces = ["application/xml", "application/json"]
)
fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>
): ResponseEntity<List<Pet>> {
fun findPetsByTags(@NotNull @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>): ResponseEntity<List<Pet>> {
return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200))
}
@ApiOperation(
value = "Find pet by ID",
nickname = "getPetById",
notes = "Returns a single pet",
response = Pet::class,
authorizations = [Authorization(value = "api_key")])
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")])
@RequestMapping(
method = [RequestMethod.GET],
value = ["/pet/{petId}"],
produces = ["application/xml", "application/json"]
)
fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: kotlin.Long
): ResponseEntity<Pet> {
fun getPetById( @PathVariable("petId") petId: kotlin.Long): ResponseEntity<Pet> {
return ResponseEntity(service.getPetById(petId), HttpStatus.valueOf(200))
}
@ApiOperation(
value = "Update an existing pet",
nickname = "updatePet",
notes = "",
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
@ApiResponses(
value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")])
@RequestMapping(
method = [RequestMethod.PUT],
value = ["/pet"],
consumes = ["application/json", "application/xml"]
)
fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet
): ResponseEntity<Unit> {
fun updatePet( @Valid @RequestBody body: Pet): ResponseEntity<Unit> {
return ResponseEntity(service.updatePet(body), HttpStatus.valueOf(400))
}
@ApiOperation(
value = "Updates a pet in the store with form data",
nickname = "updatePetWithForm",
notes = "",
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
@ApiResponses(
value = [ApiResponse(code = 405, message = "Invalid input")])
@RequestMapping(
method = [RequestMethod.POST],
value = ["/pet/{petId}"],
consumes = ["application/x-www-form-urlencoded"]
)
fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: kotlin.Long
,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: kotlin.String?
,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: kotlin.String?
): ResponseEntity<Unit> {
fun updatePetWithForm( @PathVariable("petId") petId: kotlin.Long, @RequestParam(value = "name", required = false) name: kotlin.String? , @RequestParam(value = "status", required = false) status: kotlin.String? ): ResponseEntity<Unit> {
return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.valueOf(405))
}
@ApiOperation(
value = "uploads an image",
nickname = "uploadFile",
notes = "",
response = ModelApiResponse::class,
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)])
@RequestMapping(
method = [RequestMethod.POST],
value = ["/pet/{petId}/uploadImage"],
produces = ["application/json"],
consumes = ["multipart/form-data"]
)
fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: kotlin.Long
,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.String?
,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource?
): ResponseEntity<ModelApiResponse> {
fun uploadFile( @PathVariable("petId") petId: kotlin.Long, @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? , @Valid @RequestPart("file") file: org.springframework.core.io.Resource?): ResponseEntity<ModelApiResponse> {
return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200))
}
}

View File

@@ -1,13 +1,6 @@
package org.openapitools.api
import org.openapitools.model.Order
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import io.swagger.annotations.ApiResponse
import io.swagger.annotations.ApiResponses
import io.swagger.annotations.Authorization
import io.swagger.annotations.AuthorizationScope
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
@@ -32,34 +25,19 @@ import kotlin.collections.Map
@RestController
@Validated
@Api(value = "store", description = "The store API")
@RequestMapping("\${api.base-path:/v2}")
class StoreApiController(@Autowired(required = true) val service: StoreApiService) {
@ApiOperation(
value = "Delete purchase order by ID",
nickname = "deleteOrder",
notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors")
@ApiResponses(
value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")])
@RequestMapping(
method = [RequestMethod.DELETE],
value = ["/store/order/{orderId}"]
)
fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: kotlin.String
): ResponseEntity<Unit> {
fun deleteOrder( @PathVariable("orderId") orderId: kotlin.String): ResponseEntity<Unit> {
return ResponseEntity(service.deleteOrder(orderId), HttpStatus.valueOf(400))
}
@ApiOperation(
value = "Returns pet inventories by status",
nickname = "getInventory",
notes = "Returns a map of status codes to quantities",
response = kotlin.Int::class,
responseContainer = "Map",
authorizations = [Authorization(value = "api_key")])
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")])
@RequestMapping(
method = [RequestMethod.GET],
value = ["/store/inventory"],
@@ -69,37 +47,23 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic
return ResponseEntity(service.getInventory(), HttpStatus.valueOf(200))
}
@ApiOperation(
value = "Find purchase order by ID",
nickname = "getOrderById",
notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
response = Order::class)
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")])
@RequestMapping(
method = [RequestMethod.GET],
value = ["/store/order/{orderId}"],
produces = ["application/xml", "application/json"]
)
fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: kotlin.Long
): ResponseEntity<Order> {
fun getOrderById(@Min(1L) @Max(5L) @PathVariable("orderId") orderId: kotlin.Long): ResponseEntity<Order> {
return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200))
}
@ApiOperation(
value = "Place an order for a pet",
nickname = "placeOrder",
notes = "",
response = Order::class)
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")])
@RequestMapping(
method = [RequestMethod.POST],
value = ["/store/order"],
produces = ["application/xml", "application/json"]
)
fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody body: Order
): ResponseEntity<Order> {
fun placeOrder( @Valid @RequestBody body: Order): ResponseEntity<Order> {
return ResponseEntity(service.placeOrder(body), HttpStatus.valueOf(200))
}
}

View File

@@ -1,13 +1,6 @@
package org.openapitools.api
import org.openapitools.model.User
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import io.swagger.annotations.ApiResponse
import io.swagger.annotations.ApiResponses
import io.swagger.annotations.Authorization
import io.swagger.annotations.AuthorizationScope
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
@@ -32,111 +25,66 @@ import kotlin.collections.Map
@RestController
@Validated
@Api(value = "user", description = "The user API")
@RequestMapping("\${api.base-path:/v2}")
class UserApiController(@Autowired(required = true) val service: UserApiService) {
@ApiOperation(
value = "Create user",
nickname = "createUser",
notes = "This can only be done by the logged in user.")
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation")])
@RequestMapping(
method = [RequestMethod.POST],
value = ["/user"]
)
fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody body: User
): ResponseEntity<Unit> {
fun createUser( @Valid @RequestBody body: User): ResponseEntity<Unit> {
return ResponseEntity(service.createUser(body), HttpStatus.valueOf(200))
}
@ApiOperation(
value = "Creates list of users with given input array",
nickname = "createUsersWithArrayInput",
notes = "")
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation")])
@RequestMapping(
method = [RequestMethod.POST],
value = ["/user/createWithArray"]
)
fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: kotlin.collections.List<User>
): ResponseEntity<Unit> {
fun createUsersWithArrayInput( @Valid @RequestBody body: kotlin.collections.List<User>): ResponseEntity<Unit> {
return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.valueOf(200))
}
@ApiOperation(
value = "Creates list of users with given input array",
nickname = "createUsersWithListInput",
notes = "")
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation")])
@RequestMapping(
method = [RequestMethod.POST],
value = ["/user/createWithList"]
)
fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: kotlin.collections.List<User>
): ResponseEntity<Unit> {
fun createUsersWithListInput( @Valid @RequestBody body: kotlin.collections.List<User>): ResponseEntity<Unit> {
return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.valueOf(200))
}
@ApiOperation(
value = "Delete user",
nickname = "deleteUser",
notes = "This can only be done by the logged in user.")
@ApiResponses(
value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")])
@RequestMapping(
method = [RequestMethod.DELETE],
value = ["/user/{username}"]
)
fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: kotlin.String
): ResponseEntity<Unit> {
fun deleteUser( @PathVariable("username") username: kotlin.String): ResponseEntity<Unit> {
return ResponseEntity(service.deleteUser(username), HttpStatus.valueOf(400))
}
@ApiOperation(
value = "Get user by user name",
nickname = "getUserByName",
notes = "",
response = User::class)
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")])
@RequestMapping(
method = [RequestMethod.GET],
value = ["/user/{username}"],
produces = ["application/xml", "application/json"]
)
fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: kotlin.String
): ResponseEntity<User> {
fun getUserByName( @PathVariable("username") username: kotlin.String): ResponseEntity<User> {
return ResponseEntity(service.getUserByName(username), HttpStatus.valueOf(200))
}
@ApiOperation(
value = "Logs user into the system",
nickname = "loginUser",
notes = "",
response = kotlin.String::class)
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")])
@RequestMapping(
method = [RequestMethod.GET],
value = ["/user/login"],
produces = ["application/xml", "application/json"]
)
fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String
,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String
): ResponseEntity<kotlin.String> {
fun loginUser(@NotNull @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity<kotlin.String> {
return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200))
}
@ApiOperation(
value = "Logs out current logged in user session",
nickname = "logoutUser",
notes = "")
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation")])
@RequestMapping(
method = [RequestMethod.GET],
value = ["/user/logout"]
@@ -145,19 +93,12 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
return ResponseEntity(service.logoutUser(), HttpStatus.valueOf(200))
}
@ApiOperation(
value = "Updated user",
nickname = "updateUser",
notes = "This can only be done by the logged in user.")
@ApiResponses(
value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")])
@RequestMapping(
method = [RequestMethod.PUT],
value = ["/user/{username}"]
)
fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: kotlin.String
,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody body: User
): ResponseEntity<Unit> {
fun updateUser( @PathVariable("username") username: kotlin.String, @Valid @RequestBody body: User): ResponseEntity<Unit> {
return ResponseEntity(service.updateUser(username, body), HttpStatus.valueOf(400))
}
}

View File

@@ -11,7 +11,6 @@ import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid
import io.swagger.annotations.ApiModelProperty
/**
* A category for a pet
@@ -20,10 +19,8 @@ import io.swagger.annotations.ApiModelProperty
*/
data class Category(
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") val id: kotlin.Long? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("name") val name: kotlin.String? = null
) {

View File

@@ -11,7 +11,6 @@ import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid
import io.swagger.annotations.ApiModelProperty
/**
* Describes the result of uploading an image resource
@@ -21,13 +20,10 @@ import io.swagger.annotations.ApiModelProperty
*/
data class ModelApiResponse(
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("code") val code: kotlin.Int? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("type") val type: kotlin.String? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("message") val message: kotlin.String? = null
) {

View File

@@ -12,7 +12,6 @@ import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid
import io.swagger.annotations.ApiModelProperty
/**
* An order for a pets from the pet store
@@ -25,22 +24,16 @@ import io.swagger.annotations.ApiModelProperty
*/
data class Order(
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") val id: kotlin.Long? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("petId") val petId: kotlin.Long? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("quantity") val quantity: kotlin.Int? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null,
@ApiModelProperty(example = "null", value = "Order Status")
@field:JsonProperty("status") val status: Order.Status? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("complete") val complete: kotlin.Boolean? = false
) {
@@ -49,13 +42,10 @@ data class Order(
* Values: placed,approved,delivered
*/
enum class Status(val value: kotlin.String) {
@JsonProperty("placed") placed("placed"),
@JsonProperty("approved") approved("approved"),
@JsonProperty("delivered") delivered("delivered");
@JsonProperty("delivered") delivered("delivered")
}
}

View File

@@ -14,7 +14,6 @@ import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid
import io.swagger.annotations.ApiModelProperty
/**
* A pet for sale in the pet store
@@ -27,24 +26,18 @@ import io.swagger.annotations.ApiModelProperty
*/
data class Pet(
@ApiModelProperty(example = "doggie", required = true, value = "")
@field:JsonProperty("name", required = true) val name: kotlin.String,
@ApiModelProperty(example = "null", required = true, value = "")
@field:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List<kotlin.String>,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") val id: kotlin.Long? = null,
@field:Valid
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("category") val category: Category? = null,
@field:Valid
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("tags") val tags: kotlin.collections.List<Tag>? = null,
@ApiModelProperty(example = "null", value = "pet status in the store")
@field:JsonProperty("status") val status: Pet.Status? = null
) {
@@ -53,13 +46,10 @@ data class Pet(
* Values: available,pending,sold
*/
enum class Status(val value: kotlin.String) {
@JsonProperty("available") available("available"),
@JsonProperty("pending") pending("pending"),
@JsonProperty("sold") sold("sold");
@JsonProperty("sold") sold("sold")
}
}

View File

@@ -11,7 +11,6 @@ import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid
import io.swagger.annotations.ApiModelProperty
/**
* A tag for a pet
@@ -20,10 +19,8 @@ import io.swagger.annotations.ApiModelProperty
*/
data class Tag(
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") val id: kotlin.Long? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("name") val name: kotlin.String? = null
) {

View File

@@ -11,7 +11,6 @@ import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid
import io.swagger.annotations.ApiModelProperty
/**
* A User who is purchasing from the pet store
@@ -26,28 +25,20 @@ import io.swagger.annotations.ApiModelProperty
*/
data class User(
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("id") val id: kotlin.Long? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("username") val username: kotlin.String? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("firstName") val firstName: kotlin.String? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("lastName") val lastName: kotlin.String? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("email") val email: kotlin.String? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("password") val password: kotlin.String? = null,
@ApiModelProperty(example = "null", value = "")
@field:JsonProperty("phone") val phone: kotlin.String? = null,
@ApiModelProperty(example = "null", value = "User Status")
@field:JsonProperty("userStatus") val userStatus: kotlin.Int? = null
) {

View File

@@ -18,7 +18,7 @@ class PetApiTest {
*/
@Test
fun addPetTest() {
val body:Pet = TODO()
val body: Pet = TODO()
val response: ResponseEntity<Unit> = api.addPet(body)
// TODO: test validations
@@ -32,8 +32,8 @@ class PetApiTest {
*/
@Test
fun deletePetTest() {
val petId:kotlin.Long = TODO()
val apiKey:kotlin.String? = TODO()
val petId: kotlin.Long = TODO()
val apiKey: kotlin.String? = TODO()
val response: ResponseEntity<Unit> = api.deletePet(petId, apiKey)
// TODO: test validations
@@ -47,7 +47,7 @@ class PetApiTest {
*/
@Test
fun findPetsByStatusTest() {
val status:kotlin.collections.List<kotlin.String> = TODO()
val status: kotlin.collections.List<kotlin.String> = TODO()
val response: ResponseEntity<List<Pet>> = api.findPetsByStatus(status)
// TODO: test validations
@@ -61,7 +61,7 @@ class PetApiTest {
*/
@Test
fun findPetsByTagsTest() {
val tags:kotlin.collections.List<kotlin.String> = TODO()
val tags: kotlin.collections.List<kotlin.String> = TODO()
val response: ResponseEntity<List<Pet>> = api.findPetsByTags(tags)
// TODO: test validations
@@ -75,7 +75,7 @@ class PetApiTest {
*/
@Test
fun getPetByIdTest() {
val petId:kotlin.Long = TODO()
val petId: kotlin.Long = TODO()
val response: ResponseEntity<Pet> = api.getPetById(petId)
// TODO: test validations
@@ -89,7 +89,7 @@ class PetApiTest {
*/
@Test
fun updatePetTest() {
val body:Pet = TODO()
val body: Pet = TODO()
val response: ResponseEntity<Unit> = api.updatePet(body)
// TODO: test validations
@@ -103,9 +103,9 @@ class PetApiTest {
*/
@Test
fun updatePetWithFormTest() {
val petId:kotlin.Long = TODO()
val name:kotlin.String? = TODO()
val status:kotlin.String? = TODO()
val petId: kotlin.Long = TODO()
val name: kotlin.String? = TODO()
val status: kotlin.String? = TODO()
val response: ResponseEntity<Unit> = api.updatePetWithForm(petId, name, status)
// TODO: test validations
@@ -119,12 +119,11 @@ class PetApiTest {
*/
@Test
fun uploadFileTest() {
val petId:kotlin.Long = TODO()
val additionalMetadata:kotlin.String? = TODO()
val file:org.springframework.core.io.Resource? = TODO()
val petId: kotlin.Long = TODO()
val additionalMetadata: kotlin.String? = TODO()
val file: org.springframework.core.io.Resource? = TODO()
val response: ResponseEntity<ModelApiResponse> = api.uploadFile(petId, additionalMetadata, file)
// TODO: test validations
}
}

View File

@@ -17,7 +17,7 @@ class StoreApiTest {
*/
@Test
fun deleteOrderTest() {
val orderId:kotlin.String = TODO()
val orderId: kotlin.String = TODO()
val response: ResponseEntity<Unit> = api.deleteOrder(orderId)
// TODO: test validations
@@ -44,7 +44,7 @@ class StoreApiTest {
*/
@Test
fun getOrderByIdTest() {
val orderId:kotlin.Long = TODO()
val orderId: kotlin.Long = TODO()
val response: ResponseEntity<Order> = api.getOrderById(orderId)
// TODO: test validations
@@ -58,10 +58,9 @@ class StoreApiTest {
*/
@Test
fun placeOrderTest() {
val body:Order = TODO()
val body: Order = TODO()
val response: ResponseEntity<Order> = api.placeOrder(body)
// TODO: test validations
}
}

View File

@@ -17,7 +17,7 @@ class UserApiTest {
*/
@Test
fun createUserTest() {
val body:User = TODO()
val body: User = TODO()
val response: ResponseEntity<Unit> = api.createUser(body)
// TODO: test validations
@@ -31,7 +31,7 @@ class UserApiTest {
*/
@Test
fun createUsersWithArrayInputTest() {
val body:kotlin.collections.List<User> = TODO()
val body: kotlin.collections.List<User> = TODO()
val response: ResponseEntity<Unit> = api.createUsersWithArrayInput(body)
// TODO: test validations
@@ -45,7 +45,7 @@ class UserApiTest {
*/
@Test
fun createUsersWithListInputTest() {
val body:kotlin.collections.List<User> = TODO()
val body: kotlin.collections.List<User> = TODO()
val response: ResponseEntity<Unit> = api.createUsersWithListInput(body)
// TODO: test validations
@@ -59,7 +59,7 @@ class UserApiTest {
*/
@Test
fun deleteUserTest() {
val username:kotlin.String = TODO()
val username: kotlin.String = TODO()
val response: ResponseEntity<Unit> = api.deleteUser(username)
// TODO: test validations
@@ -73,7 +73,7 @@ class UserApiTest {
*/
@Test
fun getUserByNameTest() {
val username:kotlin.String = TODO()
val username: kotlin.String = TODO()
val response: ResponseEntity<User> = api.getUserByName(username)
// TODO: test validations
@@ -87,8 +87,8 @@ class UserApiTest {
*/
@Test
fun loginUserTest() {
val username:kotlin.String = TODO()
val password:kotlin.String = TODO()
val username: kotlin.String = TODO()
val password: kotlin.String = TODO()
val response: ResponseEntity<kotlin.String> = api.loginUser(username, password)
// TODO: test validations
@@ -115,11 +115,10 @@ class UserApiTest {
*/
@Test
fun updateUserTest() {
val username:kotlin.String = TODO()
val body:User = TODO()
val username: kotlin.String = TODO()
val body: User = TODO()
val response: ResponseEntity<Unit> = api.updateUser(username, body)
// TODO: test validations
}
}