mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-07 14:56:11 +00:00
Add Flow import to kotlin spring reactive (#3107)
* Add Flow import to kotlin spring reactive * Add runBlockingTest to api tests * Add kotlin-springboot-petstore-server-reactive.sh to ensure-up-to-date * add reactive check for runBlockingTest * Samples
This commit is contained in:
committed by
William Cheng
parent
1d8c9dcc0b
commit
a882e4b3a5
@@ -57,7 +57,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.addPet(body), HttpStatus.OK)
|
||||
return ResponseEntity(service.addPet(body), HttpStatus.valueOf(405))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -70,10 +70,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
@RequestMapping(
|
||||
value = ["/pet/{petId}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
suspend fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long
|
||||
,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String?
|
||||
suspend 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> {
|
||||
return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK)
|
||||
return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.valueOf(400))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -89,9 +89,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
value = ["/pet/findByStatus"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
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: List<String>
|
||||
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<Flow<Pet>> {
|
||||
return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK)
|
||||
return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -107,9 +107,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
value = ["/pet/findByTags"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: List<String>
|
||||
fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>
|
||||
): ResponseEntity<Flow<Pet>> {
|
||||
return ResponseEntity(service.findPetsByTags(tags), HttpStatus.OK)
|
||||
return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -124,9 +124,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
value = ["/pet/{petId}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long
|
||||
suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: kotlin.Long
|
||||
): ResponseEntity<Pet> {
|
||||
return ResponseEntity(service.getPetById(petId), HttpStatus.OK)
|
||||
return ResponseEntity(service.getPetById(petId), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -142,7 +142,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
method = [RequestMethod.PUT])
|
||||
suspend fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updatePet(body), HttpStatus.OK)
|
||||
return ResponseEntity(service.updatePet(body), HttpStatus.valueOf(400))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -156,11 +156,11 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
value = ["/pet/{petId}"],
|
||||
consumes = ["application/x-www-form-urlencoded"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long
|
||||
,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: String?
|
||||
,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: String?
|
||||
suspend 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> {
|
||||
return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK)
|
||||
return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.valueOf(405))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -176,10 +176,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
produces = ["application/json"],
|
||||
consumes = ["multipart/form-data"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long
|
||||
,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String?
|
||||
suspend 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> {
|
||||
return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK)
|
||||
return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,17 +7,17 @@ interface PetApiService {
|
||||
|
||||
suspend fun addPet(body: Pet): Unit
|
||||
|
||||
suspend fun deletePet(petId: Long, apiKey: String?): Unit
|
||||
suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit
|
||||
|
||||
fun findPetsByStatus(status: List<String>): Flow<Pet>
|
||||
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): Flow<Pet>
|
||||
|
||||
fun findPetsByTags(tags: List<String>): Flow<Pet>
|
||||
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): Flow<Pet>
|
||||
|
||||
suspend fun getPetById(petId: Long): Pet
|
||||
suspend fun getPetById(petId: kotlin.Long): Pet
|
||||
|
||||
suspend fun updatePet(body: Pet): Unit
|
||||
|
||||
suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit
|
||||
suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit
|
||||
|
||||
suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse
|
||||
suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse
|
||||
}
|
||||
|
||||
@@ -11,19 +11,19 @@ class PetApiServiceImpl : PetApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun deletePet(petId: Long, apiKey: String?): Unit {
|
||||
override suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun findPetsByStatus(status: List<String>): Flow<Pet> {
|
||||
override fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): Flow<Pet> {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override fun findPetsByTags(tags: List<String>): Flow<Pet> {
|
||||
override fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): Flow<Pet> {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun getPetById(petId: Long): Pet {
|
||||
override suspend fun getPetById(petId: kotlin.Long): Pet {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ class PetApiServiceImpl : PetApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit {
|
||||
override suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse {
|
||||
override suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse {
|
||||
TODO("Implement me")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,26 +52,26 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic
|
||||
@RequestMapping(
|
||||
value = ["/store/order/{orderId}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: String
|
||||
suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: kotlin.String
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK)
|
||||
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 = Int::class,
|
||||
response = kotlin.Int::class,
|
||||
responseContainer = "Map",
|
||||
authorizations = [Authorization(value = "api_key")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Map::class, responseContainer = "Map")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")])
|
||||
@RequestMapping(
|
||||
value = ["/store/inventory"],
|
||||
produces = ["application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getInventory(): ResponseEntity<Map<String, Int>> {
|
||||
return ResponseEntity(service.getInventory(), HttpStatus.OK)
|
||||
suspend fun getInventory(): ResponseEntity<Map<String, kotlin.Int>> {
|
||||
return ResponseEntity(service.getInventory(), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -85,9 +85,9 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic
|
||||
value = ["/store/order/{orderId}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long
|
||||
suspend 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> {
|
||||
return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK)
|
||||
return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -103,6 +103,6 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody body: Order
|
||||
): ResponseEntity<Order> {
|
||||
return ResponseEntity(service.placeOrder(body), HttpStatus.OK)
|
||||
return ResponseEntity(service.placeOrder(body), HttpStatus.valueOf(200))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import org.openapitools.model.Order
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
interface StoreApiService {
|
||||
|
||||
suspend fun deleteOrder(orderId: String): Unit
|
||||
suspend fun deleteOrder(orderId: kotlin.String): Unit
|
||||
|
||||
suspend fun getInventory(): Map<String, Int>
|
||||
suspend fun getInventory(): Map<String, kotlin.Int>
|
||||
|
||||
suspend fun getOrderById(orderId: Long): Order
|
||||
suspend fun getOrderById(orderId: kotlin.Long): Order
|
||||
|
||||
suspend fun placeOrder(body: Order): Order
|
||||
}
|
||||
|
||||
@@ -6,15 +6,15 @@ import org.springframework.stereotype.Service
|
||||
@Service
|
||||
class StoreApiServiceImpl : StoreApiService {
|
||||
|
||||
override suspend fun deleteOrder(orderId: String): Unit {
|
||||
override suspend fun deleteOrder(orderId: kotlin.String): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun getInventory(): Map<String, Int> {
|
||||
override suspend fun getInventory(): Map<String, kotlin.Int> {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun getOrderById(orderId: Long): Order {
|
||||
override suspend fun getOrderById(orderId: kotlin.Long): Order {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody body: User
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.createUser(body), HttpStatus.OK)
|
||||
return ResponseEntity(service.createUser(body), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -68,7 +68,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow<User>
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.OK)
|
||||
return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -82,7 +82,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow<User>
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.OK)
|
||||
return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -94,9 +94,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
@RequestMapping(
|
||||
value = ["/user/{username}"],
|
||||
method = [RequestMethod.DELETE])
|
||||
suspend fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: String
|
||||
suspend fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: kotlin.String
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.deleteUser(username), HttpStatus.OK)
|
||||
return ResponseEntity(service.deleteUser(username), HttpStatus.valueOf(400))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -110,26 +110,26 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = ["/user/{username}"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String
|
||||
suspend fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: kotlin.String
|
||||
): ResponseEntity<User> {
|
||||
return ResponseEntity(service.getUserByName(username), HttpStatus.OK)
|
||||
return ResponseEntity(service.getUserByName(username), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "Logs user into the system",
|
||||
nickname = "loginUser",
|
||||
notes = "",
|
||||
response = String::class)
|
||||
response = kotlin.String::class)
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")])
|
||||
@RequestMapping(
|
||||
value = ["/user/login"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String
|
||||
,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String
|
||||
): ResponseEntity<String> {
|
||||
return ResponseEntity(service.loginUser(username, password), HttpStatus.OK)
|
||||
suspend 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> {
|
||||
return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -142,7 +142,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = ["/user/logout"],
|
||||
method = [RequestMethod.GET])
|
||||
suspend fun logoutUser(): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.logoutUser(), HttpStatus.OK)
|
||||
return ResponseEntity(service.logoutUser(), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -154,9 +154,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
@RequestMapping(
|
||||
value = ["/user/{username}"],
|
||||
method = [RequestMethod.PUT])
|
||||
suspend fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String
|
||||
suspend 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> {
|
||||
return ResponseEntity(service.updateUser(username, body), HttpStatus.OK)
|
||||
return ResponseEntity(service.updateUser(username, body), HttpStatus.valueOf(400))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@ interface UserApiService {
|
||||
|
||||
suspend fun createUsersWithListInput(body: Flow<User>): Unit
|
||||
|
||||
suspend fun deleteUser(username: String): Unit
|
||||
suspend fun deleteUser(username: kotlin.String): Unit
|
||||
|
||||
suspend fun getUserByName(username: String): User
|
||||
suspend fun getUserByName(username: kotlin.String): User
|
||||
|
||||
suspend fun loginUser(username: String, password: String): String
|
||||
suspend fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String
|
||||
|
||||
suspend fun logoutUser(): Unit
|
||||
|
||||
suspend fun updateUser(username: String, body: User): Unit
|
||||
suspend fun updateUser(username: kotlin.String, body: User): Unit
|
||||
}
|
||||
|
||||
@@ -18,15 +18,15 @@ class UserApiServiceImpl : UserApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun deleteUser(username: String): Unit {
|
||||
override suspend fun deleteUser(username: kotlin.String): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun getUserByName(username: String): User {
|
||||
override suspend fun getUserByName(username: kotlin.String): User {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun loginUser(username: String, password: String): String {
|
||||
override suspend fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class UserApiServiceImpl : UserApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun updateUser(username: String, body: User): Unit {
|
||||
override suspend fun updateUser(username: kotlin.String, body: User): Unit {
|
||||
TODO("Implement me")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class Category (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("name") val name: String? = null
|
||||
@JsonProperty("name") val name: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class ModelApiResponse (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("code") val code: Int? = null,
|
||||
@JsonProperty("code") val code: kotlin.Int? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("type") val type: String? = null,
|
||||
@JsonProperty("type") val type: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("message") val message: String? = null
|
||||
@JsonProperty("message") val message: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -24,13 +24,13 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class Order (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("petId") val petId: Long? = null,
|
||||
@JsonProperty("petId") val petId: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("quantity") val quantity: Int? = null,
|
||||
@JsonProperty("quantity") val quantity: kotlin.Int? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null,
|
||||
@@ -39,14 +39,14 @@ data class Order (
|
||||
@JsonProperty("status") val status: Order.Status? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("complete") val complete: Boolean? = null
|
||||
@JsonProperty("complete") val complete: kotlin.Boolean? = null
|
||||
) {
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
* Values: placed,approved,delivered
|
||||
*/
|
||||
enum class Status(val value: String) {
|
||||
enum class Status(val value: kotlin.String) {
|
||||
|
||||
@JsonProperty("placed") placed("placed"),
|
||||
|
||||
|
||||
@@ -27,20 +27,20 @@ data class Pet (
|
||||
|
||||
@get:NotNull
|
||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||
@JsonProperty("name") val name: String,
|
||||
@JsonProperty("name") val name: kotlin.String,
|
||||
|
||||
@get:NotNull
|
||||
@ApiModelProperty(example = "null", required = true, value = "")
|
||||
@JsonProperty("photoUrls") val photoUrls: List<String>,
|
||||
@JsonProperty("photoUrls") val photoUrls: kotlin.collections.List<kotlin.String>,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("category") val category: Category? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("tags") val tags: List<Tag>? = null,
|
||||
@JsonProperty("tags") val tags: kotlin.collections.List<Tag>? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "pet status in the store")
|
||||
@JsonProperty("status") val status: Pet.Status? = null
|
||||
@@ -50,7 +50,7 @@ data class Pet (
|
||||
* pet status in the store
|
||||
* Values: available,pending,sold
|
||||
*/
|
||||
enum class Status(val value: String) {
|
||||
enum class Status(val value: kotlin.String) {
|
||||
|
||||
@JsonProperty("available") available("available"),
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class Tag (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("name") val name: String? = null
|
||||
@JsonProperty("name") val name: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -25,28 +25,28 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class User (
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: Long? = null,
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("username") val username: String? = null,
|
||||
@JsonProperty("username") val username: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("firstName") val firstName: String? = null,
|
||||
@JsonProperty("firstName") val firstName: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("lastName") val lastName: String? = null,
|
||||
@JsonProperty("lastName") val lastName: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("email") val email: String? = null,
|
||||
@JsonProperty("email") val email: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("password") val password: String? = null,
|
||||
@JsonProperty("password") val password: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("phone") val phone: String? = null,
|
||||
@JsonProperty("phone") val phone: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "User Status")
|
||||
@JsonProperty("userStatus") val userStatus: Int? = null
|
||||
@JsonProperty("userStatus") val userStatus: kotlin.Int? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.ModelApiResponse
|
||||
import org.openapitools.model.Pet
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
import kotlinx.coroutines.test.runBlockingTest
|
||||
import org.springframework.http.ResponseEntity
|
||||
|
||||
class PetApiTest {
|
||||
|
||||
private val service: PetApiService = PetApiServiceImpl()
|
||||
private val api: PetApiController = PetApiController(service)
|
||||
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun addPetTest() = runBlockingTest {
|
||||
val body:Pet? = null
|
||||
val response: ResponseEntity<Unit> = api.addPet(body!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun deletePetTest() = runBlockingTest {
|
||||
val petId:kotlin.Long? = null
|
||||
val apiKey:kotlin.String? = null
|
||||
val response: ResponseEntity<Unit> = api.deletePet(petId!!, apiKey!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
*
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun findPetsByStatusTest() = runBlockingTest {
|
||||
val status:kotlin.collections.List<kotlin.String>? = null
|
||||
val response: ResponseEntity<Flow<Pet>> = api.findPetsByStatus(status!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
*
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun findPetsByTagsTest() = runBlockingTest {
|
||||
val tags:kotlin.collections.List<kotlin.String>? = null
|
||||
val response: ResponseEntity<Flow<Pet>> = api.findPetsByTags(tags!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
*
|
||||
* Returns a single pet
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun getPetByIdTest() = runBlockingTest {
|
||||
val petId:kotlin.Long? = null
|
||||
val response: ResponseEntity<Pet> = api.getPetById(petId!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun updatePetTest() = runBlockingTest {
|
||||
val body:Pet? = null
|
||||
val response: ResponseEntity<Unit> = api.updatePet(body!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun updatePetWithFormTest() = runBlockingTest {
|
||||
val petId:kotlin.Long? = null
|
||||
val name:kotlin.String? = null
|
||||
val status:kotlin.String? = null
|
||||
val response: ResponseEntity<Unit> = api.updatePetWithForm(petId!!, name!!, status!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun uploadFileTest() = runBlockingTest {
|
||||
val petId:kotlin.Long? = null
|
||||
val additionalMetadata:kotlin.String? = null
|
||||
val file:org.springframework.core.io.Resource? = null
|
||||
val response: ResponseEntity<ModelApiResponse> = api.uploadFile(petId!!, additionalMetadata!!, file!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.Order
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
import kotlinx.coroutines.test.runBlockingTest
|
||||
import org.springframework.http.ResponseEntity
|
||||
|
||||
class StoreApiTest {
|
||||
|
||||
private val service: StoreApiService = StoreApiServiceImpl()
|
||||
private val api: StoreApiController = StoreApiController(service)
|
||||
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
*
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun deleteOrderTest() = runBlockingTest {
|
||||
val orderId:kotlin.String? = null
|
||||
val response: ResponseEntity<Unit> = api.deleteOrder(orderId!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
*
|
||||
* Returns a map of status codes to quantities
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun getInventoryTest() = runBlockingTest {
|
||||
val response: ResponseEntity<Map<String, kotlin.Int>> = api.getInventory()
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
*
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun getOrderByIdTest() = runBlockingTest {
|
||||
val orderId:kotlin.Long? = null
|
||||
val response: ResponseEntity<Order> = api.getOrderById(orderId!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun placeOrderTest() = runBlockingTest {
|
||||
val body:Order? = null
|
||||
val response: ResponseEntity<Order> = api.placeOrder(body!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package org.openapitools.api
|
||||
|
||||
import org.openapitools.model.User
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
import kotlinx.coroutines.test.runBlockingTest
|
||||
import org.springframework.http.ResponseEntity
|
||||
|
||||
class UserApiTest {
|
||||
|
||||
private val service: UserApiService = UserApiServiceImpl()
|
||||
private val api: UserApiController = UserApiController(service)
|
||||
|
||||
|
||||
/**
|
||||
* Create user
|
||||
*
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun createUserTest() = runBlockingTest {
|
||||
val body:User? = null
|
||||
val response: ResponseEntity<Unit> = api.createUser(body!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun createUsersWithArrayInputTest() = runBlockingTest {
|
||||
val body:kotlin.collections.List<User>? = null
|
||||
val response: ResponseEntity<Unit> = api.createUsersWithArrayInput(body!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun createUsersWithListInputTest() = runBlockingTest {
|
||||
val body:kotlin.collections.List<User>? = null
|
||||
val response: ResponseEntity<Unit> = api.createUsersWithListInput(body!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
*
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun deleteUserTest() = runBlockingTest {
|
||||
val username:kotlin.String? = null
|
||||
val response: ResponseEntity<Unit> = api.deleteUser(username!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun getUserByNameTest() = runBlockingTest {
|
||||
val username:kotlin.String? = null
|
||||
val response: ResponseEntity<User> = api.getUserByName(username!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun loginUserTest() = runBlockingTest {
|
||||
val username:kotlin.String? = null
|
||||
val password:kotlin.String? = null
|
||||
val response: ResponseEntity<kotlin.String> = api.loginUser(username!!, password!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun logoutUserTest() = runBlockingTest {
|
||||
val response: ResponseEntity<Unit> = api.logoutUser()
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
*
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
fun updateUserTest() = runBlockingTest {
|
||||
val username:kotlin.String? = null
|
||||
val body:User? = null
|
||||
val response: ResponseEntity<Unit> = api.updateUser(username!!, body!!)
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user