mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
Fix usage of javax.annotation (#6645)
* Fix usage of javax.annotation:javax.annotation-api * Regenerate samples ``` bin/generate-samples.sh bin/configs/java-* bin/configs/jaxrs-* bin/configs/spring-* bin/configs/kotlin-* bin/configs/other/java-* bin/configs/other/jaxrs-* bin/configs/other/kotlin-* bin/configs/other/openapi3/jaxrs-cxf-client.yaml bin/configs/other/openapi3/kotlin-* ```
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
README.md
|
||||
build.gradle.kts
|
||||
pom.xml
|
||||
settings.gradle
|
||||
src/main/kotlin/org/openapitools/Application.kt
|
||||
src/main/kotlin/org/openapitools/api/ApiUtil.kt
|
||||
src/main/kotlin/org/openapitools/api/PetApi.kt
|
||||
src/main/kotlin/org/openapitools/api/PetApiService.kt
|
||||
src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt
|
||||
src/main/kotlin/org/openapitools/api/StoreApi.kt
|
||||
src/main/kotlin/org/openapitools/api/StoreApiService.kt
|
||||
src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt
|
||||
src/main/kotlin/org/openapitools/api/UserApi.kt
|
||||
src/main/kotlin/org/openapitools/api/UserApiService.kt
|
||||
src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt
|
||||
src/main/kotlin/org/openapitools/model/Category.kt
|
||||
src/main/kotlin/org/openapitools/model/InlineObject.kt
|
||||
src/main/kotlin/org/openapitools/model/InlineObject1.kt
|
||||
src/main/kotlin/org/openapitools/model/ModelApiResponse.kt
|
||||
src/main/kotlin/org/openapitools/model/Order.kt
|
||||
src/main/kotlin/org/openapitools/model/Pet.kt
|
||||
src/main/kotlin/org/openapitools/model/Tag.kt
|
||||
src/main/kotlin/org/openapitools/model/User.kt
|
||||
src/main/resources/application.yaml
|
||||
@@ -1 +1 @@
|
||||
4.3.0-SNAPSHOT
|
||||
5.0.0-SNAPSHOT
|
||||
@@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url = uri("https://repo1.maven.org/maven2") }
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3")
|
||||
@@ -15,7 +15,7 @@ version = "1.0.0"
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url = uri("https://repo1.maven.org/maven2") }
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
@@ -51,7 +51,7 @@ dependencies {
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://repo1.maven.org/maven2") }
|
||||
maven { url = uri("https://repo.spring.io/snapshot") }
|
||||
maven { url = uri("https://repo.spring.io/milestone") }
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<properties>
|
||||
<kotlin.version>1.3.30</kotlin.version>
|
||||
<kotlinx-coroutines.version>1.2.0</kotlinx-coroutines.version>
|
||||
<javax-annotation-version>1.3.2</javax-annotation-version>
|
||||
</properties>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -123,6 +124,12 @@
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>${javax-annotation-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-test-junit5</artifactId>
|
||||
|
||||
@@ -40,7 +40,7 @@ import kotlin.collections.Map
|
||||
|
||||
@RestController
|
||||
@Validated
|
||||
@Api(value = "Pet", description = "The Pet API")
|
||||
@Api(value = "pet", description = "The pet API")
|
||||
@RequestMapping("\${api.base-path:/v2}")
|
||||
class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
|
||||
@@ -48,16 +48,18 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
value = "Add a new pet to the store",
|
||||
nickname = "addPet",
|
||||
notes = "",
|
||||
response = Pet::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 = 405, message = "Invalid input")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 405, message = "Invalid input")])
|
||||
@RequestMapping(
|
||||
value = ["/pet"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.POST])
|
||||
suspend fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.addPet(pet), HttpStatus.valueOf(405))
|
||||
): ResponseEntity<Pet> {
|
||||
return ResponseEntity(service.addPet(pet), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
@@ -133,16 +135,18 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
||||
value = "Update an existing pet",
|
||||
nickname = "updatePet",
|
||||
notes = "",
|
||||
response = Pet::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 = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")])
|
||||
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")])
|
||||
@RequestMapping(
|
||||
value = ["/pet"],
|
||||
produces = ["application/xml", "application/json"],
|
||||
consumes = ["application/json", "application/xml"],
|
||||
method = [RequestMethod.PUT])
|
||||
suspend fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet
|
||||
): ResponseEntity<Unit> {
|
||||
return ResponseEntity(service.updatePet(pet), HttpStatus.valueOf(400))
|
||||
): ResponseEntity<Pet> {
|
||||
return ResponseEntity(service.updatePet(pet), HttpStatus.valueOf(200))
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.openapitools.model.Pet
|
||||
import kotlinx.coroutines.flow.Flow;
|
||||
interface PetApiService {
|
||||
|
||||
suspend fun addPet(pet: Pet): Unit
|
||||
suspend fun addPet(pet: Pet): Pet
|
||||
|
||||
suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit
|
||||
|
||||
@@ -15,7 +15,7 @@ interface PetApiService {
|
||||
|
||||
suspend fun getPetById(petId: kotlin.Long): Pet
|
||||
|
||||
suspend fun updatePet(pet: Pet): Unit
|
||||
suspend fun updatePet(pet: Pet): Pet
|
||||
|
||||
suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.springframework.stereotype.Service
|
||||
@Service
|
||||
class PetApiServiceImpl : PetApiService {
|
||||
|
||||
override suspend fun addPet(pet: Pet): Unit {
|
||||
override suspend fun addPet(pet: Pet): Pet {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class PetApiServiceImpl : PetApiService {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
override suspend fun updatePet(pet: Pet): Unit {
|
||||
override suspend fun updatePet(pet: Pet): Pet {
|
||||
TODO("Implement me")
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import kotlin.collections.Map
|
||||
|
||||
@RestController
|
||||
@Validated
|
||||
@Api(value = "Store", description = "The Store API")
|
||||
@Api(value = "store", description = "The store API")
|
||||
@RequestMapping("\${api.base-path:/v2}")
|
||||
class StoreApiController(@Autowired(required = true) val service: StoreApiService) {
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import kotlin.collections.Map
|
||||
|
||||
@RestController
|
||||
@Validated
|
||||
@Api(value = "User", description = "The User API")
|
||||
@Api(value = "user", description = "The user API")
|
||||
@RequestMapping("\${api.base-path:/v2}")
|
||||
class UserApiController(@Autowired(required = true) val service: UserApiService) {
|
||||
|
||||
@@ -47,7 +47,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = "Create user",
|
||||
nickname = "createUser",
|
||||
notes = "This can only be done by the logged in user.",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
authorizations = [Authorization(value = "api_key")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
@RequestMapping(
|
||||
@@ -63,7 +63,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = "Creates list of users with given input array",
|
||||
nickname = "createUsersWithArrayInput",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
authorizations = [Authorization(value = "api_key")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
@RequestMapping(
|
||||
@@ -79,7 +79,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = "Creates list of users with given input array",
|
||||
nickname = "createUsersWithListInput",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
authorizations = [Authorization(value = "api_key")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
@RequestMapping(
|
||||
@@ -95,7 +95,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = "Delete user",
|
||||
nickname = "deleteUser",
|
||||
notes = "This can only be done by the logged in user.",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
authorizations = [Authorization(value = "api_key")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")])
|
||||
@RequestMapping(
|
||||
@@ -143,7 +143,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = "Logs out current logged in user session",
|
||||
nickname = "logoutUser",
|
||||
notes = "",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
authorizations = [Authorization(value = "api_key")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 200, message = "successful operation")])
|
||||
@RequestMapping(
|
||||
@@ -157,7 +157,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
||||
value = "Updated user",
|
||||
nickname = "updateUser",
|
||||
notes = "This can only be done by the logged in user.",
|
||||
authorizations = [Authorization(value = "auth_cookie")])
|
||||
authorizations = [Authorization(value = "api_key")])
|
||||
@ApiResponses(
|
||||
value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")])
|
||||
@RequestMapping(
|
||||
|
||||
@@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class Category(
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
@field:JsonProperty("id") val id: kotlin.Long? = null,
|
||||
@get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("name") val name: kotlin.String? = null
|
||||
@field:JsonProperty("name") val name: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class InlineObject(
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Updated name of the pet")
|
||||
@JsonProperty("name") val name: kotlin.String? = null,
|
||||
@field:JsonProperty("name") val name: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Updated status of the pet")
|
||||
@JsonProperty("status") val status: kotlin.String? = null
|
||||
@field:JsonProperty("status") val status: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class InlineObject1(
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Additional data to pass to server")
|
||||
@JsonProperty("additionalMetadata") val additionalMetadata: kotlin.String? = null,
|
||||
@field:JsonProperty("additionalMetadata") val additionalMetadata: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "file to upload")
|
||||
@JsonProperty("file") val file: org.springframework.core.io.Resource? = null
|
||||
@field:JsonProperty("file") val file: org.springframework.core.io.Resource? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class ModelApiResponse(
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("code") val code: kotlin.Int? = null,
|
||||
@field:JsonProperty("code") val code: kotlin.Int? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("type") val type: kotlin.String? = null,
|
||||
@field:JsonProperty("type") val type: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("message") val message: kotlin.String? = null
|
||||
@field:JsonProperty("message") val message: kotlin.String? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
@@ -24,22 +24,22 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class Order(
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
@field:JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("petId") val petId: kotlin.Long? = null,
|
||||
@field:JsonProperty("petId") val petId: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("quantity") val quantity: kotlin.Int? = null,
|
||||
@field:JsonProperty("quantity") val quantity: kotlin.Int? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null,
|
||||
@field:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Order Status")
|
||||
@JsonProperty("status") val status: Order.Status? = null,
|
||||
@field:JsonProperty("status") val status: Order.Status? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("complete") val complete: kotlin.Boolean? = null
|
||||
@field:JsonProperty("complete") val complete: kotlin.Boolean? = null
|
||||
) {
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,23 +27,23 @@ data class Pet(
|
||||
|
||||
@get:NotNull
|
||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||
@JsonProperty("name") val name: kotlin.String,
|
||||
@field:JsonProperty("name") val name: kotlin.String,
|
||||
|
||||
@get:NotNull
|
||||
@ApiModelProperty(example = "null", required = true, value = "")
|
||||
@JsonProperty("photoUrls") val photoUrls: kotlin.collections.List<kotlin.String>,
|
||||
@field:JsonProperty("photoUrls") val photoUrls: kotlin.collections.List<kotlin.String>,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
@field:JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("category") val category: Category? = null,
|
||||
@field:JsonProperty("category") val category: Category? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("tags") val tags: kotlin.collections.List<Tag>? = null,
|
||||
@field: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
|
||||
@field:JsonProperty("status") val status: Pet.Status? = null
|
||||
) {
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty
|
||||
data class Tag(
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||
@field:JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("name") val name: kotlin.String? = null
|
||||
@field: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: kotlin.Long? = null,
|
||||
@field:JsonProperty("id") val id: kotlin.Long? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("username") val username: kotlin.String? = null,
|
||||
@field:JsonProperty("username") val username: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("firstName") val firstName: kotlin.String? = null,
|
||||
@field:JsonProperty("firstName") val firstName: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("lastName") val lastName: kotlin.String? = null,
|
||||
@field:JsonProperty("lastName") val lastName: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("email") val email: kotlin.String? = null,
|
||||
@field:JsonProperty("email") val email: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("password") val password: kotlin.String? = null,
|
||||
@field:JsonProperty("password") val password: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("phone") val phone: kotlin.String? = null,
|
||||
@field:JsonProperty("phone") val phone: kotlin.String? = null,
|
||||
|
||||
@ApiModelProperty(example = "null", value = "User Status")
|
||||
@JsonProperty("userStatus") val userStatus: kotlin.Int? = null
|
||||
@field:JsonProperty("userStatus") val userStatus: kotlin.Int? = null
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user