Skip to content

Commit 86257a0

Browse files
committed
fix
1 parent 0a134a1 commit 86257a0

16 files changed

Lines changed: 290 additions & 317 deletions

File tree

bin/configs/kotlin-spring-boot-x-kotlin-implements.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ library: spring-boot
44
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml
55
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
66
additionalProperties:
7-
documentationProvider: springdoc
8-
annotationLibrary: swagger2
7+
documentationProvider: none
8+
annotationLibrary: swagger1
99
useSwaggerUI: false
1010
serviceImplementation: false
1111
skipDefaultInterface: true

samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator/FILES

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ gradlew
66
gradlew.bat
77
pom.xml
88
settings.gradle
9-
src/main/kotlin/org/openapitools/SpringDocConfiguration.kt
109
src/main/kotlin/org/openapitools/api/ApiUtil.kt
1110
src/main/kotlin/org/openapitools/api/Exceptions.kt
1211
src/main/kotlin/org/openapitools/api/PetApi.kt

samples/server/petstore/kotlin-springboot-x-kotlin-implements/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dependencies {
3737
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
3838
implementation("org.jetbrains.kotlin:kotlin-reflect")
3939
implementation("org.springframework.boot:spring-boot-starter-web")
40-
implementation("org.springdoc:springdoc-openapi-webmvc-core:1.6.8")
40+
implementation("io.swagger:swagger-annotations:1.6.6")
4141

4242
implementation("com.google.code.findbugs:jsr305:3.0.2")
4343
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")

samples/server/petstore/kotlin-springboot-x-kotlin-implements/pom.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<name>openapi-spring</name>
77
<version>1.0.0</version>
88
<properties>
9+
<swagger-annotations.version>1.6.6</swagger-annotations.version>
910
<findbugs-jsr305.version>3.0.2</findbugs-jsr305.version>
1011
<javax-annotation.version>1.3.2</javax-annotation.version>
1112
<kotlin-test-junit5.version>1.6.21</kotlin-test-junit5.version>
@@ -86,11 +87,11 @@
8687
<artifactId>spring-boot-starter-web</artifactId>
8788
</dependency>
8889

89-
<!--SpringDoc dependencies -->
90+
9091
<dependency>
91-
<groupId>org.springdoc</groupId>
92-
<artifactId>springdoc-openapi-webmvc-core</artifactId>
93-
<version>${springdoc-openapi.version}</version>
92+
<groupId>io.swagger</groupId>
93+
<artifactId>swagger-annotations</artifactId>
94+
<version>${swagger-annotations.version}</version>
9495
</dependency>
9596

9697
<!-- @Nullable annotation -->

samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/PetApi.kt

Lines changed: 93 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ package org.openapitools.api
77

88
import org.openapitools.model.ModelApiResponse
99
import org.openapitools.model.Pet
10-
import io.swagger.v3.oas.annotations.*
11-
import io.swagger.v3.oas.annotations.enums.*
12-
import io.swagger.v3.oas.annotations.media.*
13-
import io.swagger.v3.oas.annotations.responses.*
14-
import io.swagger.v3.oas.annotations.security.*
10+
import io.swagger.annotations.Api
11+
import io.swagger.annotations.ApiOperation
12+
import io.swagger.annotations.ApiParam
13+
import io.swagger.annotations.ApiResponse
14+
import io.swagger.annotations.ApiResponses
15+
import io.swagger.annotations.Authorization
16+
import io.swagger.annotations.AuthorizationScope
1517
import org.springframework.http.HttpStatus
1618
import org.springframework.http.MediaType
1719
import org.springframework.http.ResponseEntity
@@ -36,147 +38,132 @@ import kotlin.collections.Map
3638

3739
@RestController
3840
@Validated
41+
@Api(value = "pet", description = "The pet API")
3942
interface PetApi {
4043

41-
@Operation(
42-
tags = ["pet",],
43-
summary = "Add a new pet to the store",
44-
operationId = "addPet",
45-
description = """""",
46-
responses = [
47-
ApiResponse(responseCode = "405", description = "Invalid input")
48-
],
49-
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
50-
)
44+
45+
@ApiOperation(
46+
value = "Add a new pet to the store",
47+
nickname = "addPet",
48+
notes = "",
49+
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
50+
@ApiResponses(
51+
value = [ApiResponse(code = 405, message = "Invalid input")])
5152
@RequestMapping(
5253
method = [RequestMethod.POST],
5354
value = ["/pet"],
5455
consumes = ["application/json"]
5556
)
56-
fun addPet(@Parameter(description = "", required = true) @Valid @RequestBody pet: Pet, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<Unit>
57-
58-
@Operation(
59-
tags = ["pet",],
60-
summary = "Deletes a pet",
61-
operationId = "deletePet",
62-
description = """""",
63-
responses = [
64-
ApiResponse(responseCode = "400", description = "Invalid pet value")
65-
],
66-
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
67-
)
57+
fun addPet(@ApiParam(value = "", required = true) @Valid @RequestBody pet: Pet, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<Unit>
58+
59+
60+
@ApiOperation(
61+
value = "Deletes a pet",
62+
nickname = "deletePet",
63+
notes = "",
64+
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
65+
@ApiResponses(
66+
value = [ApiResponse(code = 400, message = "Invalid pet value")])
6867
@RequestMapping(
6968
method = [RequestMethod.DELETE],
7069
value = ["/pet/{petId}"]
7170
)
72-
fun deletePet(@Parameter(description = "Pet id to delete", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "", `in` = ParameterIn.HEADER) @RequestHeader(value = "api_key", required = false) apiKey: kotlin.String?, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<Unit>
73-
74-
@Operation(
75-
tags = ["pet",],
76-
summary = "Finds Pets by status",
77-
operationId = "findPetsByStatus",
78-
description = """Multiple status values can be provided with comma separated strings""",
79-
responses = [
80-
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
81-
ApiResponse(responseCode = "400", description = "Invalid status value")
82-
],
83-
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
84-
)
71+
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?, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<Unit>
72+
73+
74+
@ApiOperation(
75+
value = "Finds Pets by status",
76+
nickname = "findPetsByStatus",
77+
notes = "Multiple status values can be provided with comma separated strings",
78+
response = Pet::class,
79+
responseContainer = "List",
80+
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
81+
@ApiResponses(
82+
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"), ApiResponse(code = 400, message = "Invalid status value")])
8583
@RequestMapping(
8684
method = [RequestMethod.GET],
8785
value = ["/pet/findByStatus"],
8886
produces = ["application/json"]
8987
)
90-
fun findPetsByStatus(@NotNull @Parameter(description = "Status values that need to be considered for filter", required = true, schema = Schema(allowableValues = ["available", "pending", "sold"])) @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List<kotlin.String>, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<List<Pet>>
91-
92-
@Operation(
93-
tags = ["pet",],
94-
summary = "Finds Pets by tags",
95-
operationId = "findPetsByTags",
96-
description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""",
97-
responses = [
98-
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
99-
ApiResponse(responseCode = "400", description = "Invalid tag value")
100-
],
101-
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
102-
)
88+
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>, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<List<Pet>>
89+
90+
91+
@ApiOperation(
92+
value = "Finds Pets by tags",
93+
nickname = "findPetsByTags",
94+
notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
95+
response = Pet::class,
96+
responseContainer = "List",
97+
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
98+
@ApiResponses(
99+
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"), ApiResponse(code = 400, message = "Invalid tag value")])
103100
@RequestMapping(
104101
method = [RequestMethod.GET],
105102
value = ["/pet/findByTags"],
106103
produces = ["application/json"]
107104
)
108-
fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<List<Pet>>
109-
110-
@Operation(
111-
tags = ["pet",],
112-
summary = "Find pet by ID",
113-
operationId = "getPetById",
114-
description = """Returns a single pet""",
115-
responses = [
116-
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]),
117-
ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
118-
ApiResponse(responseCode = "404", description = "Pet not found")
119-
],
120-
security = [ SecurityRequirement(name = "api_key") ]
121-
)
105+
fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<List<Pet>>
106+
107+
108+
@ApiOperation(
109+
value = "Find pet by ID",
110+
nickname = "getPetById",
111+
notes = "Returns a single pet",
112+
response = Pet::class,
113+
authorizations = [Authorization(value = "api_key")])
114+
@ApiResponses(
115+
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class), ApiResponse(code = 400, message = "Invalid ID supplied"), ApiResponse(code = 404, message = "Pet not found")])
122116
@RequestMapping(
123117
method = [RequestMethod.GET],
124118
value = ["/pet/{petId}"],
125119
produces = ["application/json"]
126120
)
127-
fun getPetById(@Parameter(description = "ID of pet to return", required = true) @PathVariable("petId") petId: kotlin.Long, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<Pet>
128-
129-
@Operation(
130-
tags = ["pet",],
131-
summary = "Update an existing pet",
132-
operationId = "updatePet",
133-
description = """""",
134-
responses = [
135-
ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
136-
ApiResponse(responseCode = "404", description = "Pet not found"),
137-
ApiResponse(responseCode = "405", description = "Validation exception")
138-
],
139-
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
140-
)
121+
fun getPetById(@ApiParam(value = "ID of pet to return", required = true) @PathVariable("petId") petId: kotlin.Long, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<Pet>
122+
123+
124+
@ApiOperation(
125+
value = "Update an existing pet",
126+
nickname = "updatePet",
127+
notes = "",
128+
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
129+
@ApiResponses(
130+
value = [ApiResponse(code = 400, message = "Invalid ID supplied"), ApiResponse(code = 404, message = "Pet not found"), ApiResponse(code = 405, message = "Validation exception")])
141131
@RequestMapping(
142132
method = [RequestMethod.PUT],
143133
value = ["/pet"],
144134
consumes = ["application/json"]
145135
)
146-
fun updatePet(@Parameter(description = "", required = true) @Valid @RequestBody pet: Pet, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<Unit>
147-
148-
@Operation(
149-
tags = ["pet",],
150-
summary = "Updates a pet in the store with form data",
151-
operationId = "updatePetWithForm",
152-
description = """""",
153-
responses = [
154-
ApiResponse(responseCode = "405", description = "Invalid input")
155-
],
156-
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
157-
)
136+
fun updatePet(@ApiParam(value = "", required = true) @Valid @RequestBody pet: Pet, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<Unit>
137+
138+
139+
@ApiOperation(
140+
value = "Updates a pet in the store with form data",
141+
nickname = "updatePetWithForm",
142+
notes = "",
143+
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
144+
@ApiResponses(
145+
value = [ApiResponse(code = 405, message = "Invalid input")])
158146
@RequestMapping(
159147
method = [RequestMethod.POST],
160148
value = ["/pet/{petId}"],
161149
consumes = ["application/x-www-form-urlencoded"]
162150
)
163-
fun updatePetWithForm(@Parameter(description = "ID of pet that needs to be updated", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Updated name of the pet") @Valid @RequestParam(value = "name", required = false) name: kotlin.String? ,@Parameter(description = "Updated status of the pet") @Valid @RequestParam(value = "status", required = false) status: kotlin.String? , @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<Unit>
164-
165-
@Operation(
166-
tags = ["pet",],
167-
summary = "Uploads an image",
168-
operationId = "uploadFile",
169-
description = """""",
170-
responses = [
171-
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = ModelApiResponse::class))])
172-
],
173-
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
174-
)
151+
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") @Valid @RequestParam(value = "name", required = false) name: kotlin.String? ,@ApiParam(value = "Updated status of the pet") @Valid @RequestParam(value = "status", required = false) status: kotlin.String? , @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<Unit>
152+
153+
154+
@ApiOperation(
155+
value = "Uploads an image",
156+
nickname = "uploadFile",
157+
notes = "",
158+
response = ModelApiResponse::class,
159+
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
160+
@ApiResponses(
161+
value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)])
175162
@RequestMapping(
176163
method = [RequestMethod.POST],
177164
value = ["/pet/{petId}/uploadImage"],
178165
produces = ["application/json"],
179166
consumes = ["multipart/form-data"]
180167
)
181-
fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "") @Valid @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "") @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile, @Parameter(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<ModelApiResponse>
168+
fun uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@ApiParam(value = "") @Valid @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@ApiParam(value = "file detail") @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile, @ApiParam(hidden = true) request: javax.servlet.http.HttpServletRequest): ResponseEntity<ModelApiResponse>
182169
}

0 commit comments

Comments
 (0)