Skip to content

Commit 3086ce8

Browse files
committed
remove unnecessary generated files
1 parent fb35015 commit 3086ce8

19 files changed

Lines changed: 846 additions & 17 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ additionalProperties:
77
documentationProvider: none
88
annotationLibrary: none
99
useSwaggerUI: "false"
10-
serviceImplementation: "true"
10+
serviceImplementation: "false"
11+
skipDefaultInterface: "true"
12+
interfaceOnly: "true"
1113
serializableModel: "true"
1214
beanValidations: "true"
13-
requestMappingMode: controller

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

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,11 @@ gradlew
66
gradlew.bat
77
pom.xml
88
settings.gradle
9-
src/main/kotlin/org/openapitools/Application.kt
109
src/main/kotlin/org/openapitools/api/ApiUtil.kt
1110
src/main/kotlin/org/openapitools/api/Exceptions.kt
12-
src/main/kotlin/org/openapitools/api/PetApiController.kt
13-
src/main/kotlin/org/openapitools/api/PetApiService.kt
14-
src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt
15-
src/main/kotlin/org/openapitools/api/StoreApiController.kt
16-
src/main/kotlin/org/openapitools/api/StoreApiService.kt
17-
src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt
18-
src/main/kotlin/org/openapitools/api/UserApiController.kt
19-
src/main/kotlin/org/openapitools/api/UserApiService.kt
20-
src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt
11+
src/main/kotlin/org/openapitools/api/PetApi.kt
12+
src/main/kotlin/org/openapitools/api/StoreApi.kt
13+
src/main/kotlin/org/openapitools/api/UserApi.kt
2114
src/main/kotlin/org/openapitools/configuration/EnumConverterConfiguration.kt
2215
src/main/kotlin/org/openapitools/model/Cat.kt
2316
src/main/kotlin/org/openapitools/model/Category.kt
@@ -28,4 +21,3 @@ src/main/kotlin/org/openapitools/model/Order.kt
2821
src/main/kotlin/org/openapitools/model/Pet.kt
2922
src/main/kotlin/org/openapitools/model/Tag.kt
3023
src/main/kotlin/org/openapitools/model/User.kt
31-
src/main/resources/application.yaml

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ tasks.withType<KotlinCompile> {
2020
kotlinOptions.jvmTarget = "1.8"
2121
}
2222

23+
tasks.bootJar {
24+
enabled = false
25+
}
26+
2327
plugins {
2428
val kotlinVersion = "1.9.25"
2529
id("org.jetbrains.kotlin.jvm") version kotlinVersion

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
2424
<plugins>
2525
<plugin>
26-
<groupId>org.springframework.boot</groupId>
27-
<artifactId>spring-boot-maven-plugin</artifactId>
26+
<groupId>org.apache.maven.plugins</groupId>
27+
<artifactId>maven-source-plugin</artifactId>
2828
<executions>
2929
<execution>
30+
<id>attach-sources</id>
3031
<goals>
31-
<goal>repackage</goal>
32+
<goal>jar</goal>
3233
</goals>
3334
</execution>
3435
</executions>
3536
</plugin>
36-
3737
<plugin>
3838
<artifactId>kotlin-maven-plugin</artifactId>
3939
<groupId>org.jetbrains.kotlin</groupId>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.openapitools.api
2+
3+
import org.springframework.web.context.request.NativeWebRequest
4+
5+
import javax.servlet.http.HttpServletResponse
6+
import java.io.IOException
7+
8+
object ApiUtil {
9+
fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) {
10+
try {
11+
val res = req.getNativeResponse(HttpServletResponse::class.java)
12+
res?.characterEncoding = "UTF-8"
13+
res?.addHeader("Content-Type", contentType)
14+
res?.writer?.print(example)
15+
} catch (e: IOException) {
16+
throw RuntimeException(e)
17+
}
18+
}
19+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.openapitools.api
2+
3+
import org.springframework.context.annotation.Configuration
4+
import org.springframework.http.HttpStatus
5+
import org.springframework.web.bind.annotation.ControllerAdvice
6+
import org.springframework.web.bind.annotation.ExceptionHandler
7+
import javax.servlet.http.HttpServletResponse
8+
import javax.validation.ConstraintViolationException
9+
10+
// TODO Extend ApiException for custom exception handling, e.g. the below NotFound exception
11+
sealed class ApiException(msg: String, val code: Int) : Exception(msg)
12+
13+
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
14+
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
16+
@ControllerAdvice
17+
class DefaultExceptionHandler {
18+
19+
@ExceptionHandler(value = [ApiException::class])
20+
fun onApiException(ex: ApiException, response: HttpServletResponse): Unit =
21+
response.sendError(ex.code, ex.message)
22+
23+
@ExceptionHandler(value = [NotImplementedError::class])
24+
fun onNotImplemented(ex: NotImplementedError, response: HttpServletResponse): Unit =
25+
response.sendError(HttpStatus.NOT_IMPLEMENTED.value())
26+
27+
@ExceptionHandler(value = [ConstraintViolationException::class])
28+
fun onConstraintViolation(ex: ConstraintViolationException, response: HttpServletResponse): Unit =
29+
response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message })
30+
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/**
2+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.16.0-SNAPSHOT).
3+
* https://openapi-generator.tech
4+
* Do not edit the class manually.
5+
*/
6+
package org.openapitools.api
7+
8+
import org.openapitools.model.ModelApiResponse
9+
import org.openapitools.model.Pet
10+
import org.springframework.http.HttpStatus
11+
import org.springframework.http.MediaType
12+
import org.springframework.http.ResponseEntity
13+
14+
import org.springframework.web.bind.annotation.*
15+
import org.springframework.validation.annotation.Validated
16+
import org.springframework.web.context.request.NativeWebRequest
17+
import org.springframework.beans.factory.annotation.Autowired
18+
19+
import javax.validation.constraints.DecimalMax
20+
import javax.validation.constraints.DecimalMin
21+
import javax.validation.constraints.Email
22+
import javax.validation.constraints.Max
23+
import javax.validation.constraints.Min
24+
import javax.validation.constraints.NotNull
25+
import javax.validation.constraints.Pattern
26+
import javax.validation.constraints.Size
27+
import javax.validation.Valid
28+
29+
import kotlin.collections.List
30+
import kotlin.collections.Map
31+
32+
@RestController
33+
@Validated
34+
interface PetApi {
35+
36+
37+
@RequestMapping(
38+
method = [RequestMethod.POST],
39+
value = ["/pet"],
40+
consumes = ["application/json"]
41+
)
42+
fun addPet( @Valid @RequestBody pet: Pet): ResponseEntity<Unit>
43+
44+
45+
@RequestMapping(
46+
method = [RequestMethod.DELETE],
47+
value = ["/pet/{petId}"]
48+
)
49+
fun deletePet( @PathVariable("petId") petId: kotlin.Long, @RequestHeader(value = "api_key", required = false) apiKey: kotlin.String?): ResponseEntity<Unit>
50+
51+
52+
@RequestMapping(
53+
method = [RequestMethod.GET],
54+
value = ["/pet/findByStatus"],
55+
produces = ["application/json"]
56+
)
57+
fun findPetsByStatus(@NotNull @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List<kotlin.String>): ResponseEntity<List<Pet>>
58+
59+
60+
@RequestMapping(
61+
method = [RequestMethod.GET],
62+
value = ["/pet/findByTags"],
63+
produces = ["application/json"]
64+
)
65+
fun findPetsByTags(@NotNull @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>): ResponseEntity<List<Pet>>
66+
67+
68+
@RequestMapping(
69+
method = [RequestMethod.GET],
70+
value = ["/pet/{petId}"],
71+
produces = ["application/json"]
72+
)
73+
fun getPetById( @PathVariable("petId") petId: kotlin.Long): ResponseEntity<Pet>
74+
75+
76+
@RequestMapping(
77+
method = [RequestMethod.PUT],
78+
value = ["/pet"],
79+
consumes = ["application/json"]
80+
)
81+
fun updatePet( @Valid @RequestBody pet: Pet): ResponseEntity<Unit>
82+
83+
84+
@RequestMapping(
85+
method = [RequestMethod.POST],
86+
value = ["/pet/{petId}"],
87+
consumes = ["application/x-www-form-urlencoded"]
88+
)
89+
fun updatePetWithForm( @PathVariable("petId") petId: kotlin.Long, @Valid @RequestParam(value = "name", required = false) name: kotlin.String? , @Valid @RequestParam(value = "status", required = false) status: kotlin.String? ): ResponseEntity<Unit>
90+
91+
92+
@RequestMapping(
93+
method = [RequestMethod.POST],
94+
value = ["/pet/{petId}/uploadImage"],
95+
produces = ["application/json"],
96+
consumes = ["multipart/form-data"]
97+
)
98+
fun uploadFile( @PathVariable("petId") petId: kotlin.Long, @Valid @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? , @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity<ModelApiResponse>
99+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.16.0-SNAPSHOT).
3+
* https://openapi-generator.tech
4+
* Do not edit the class manually.
5+
*/
6+
package org.openapitools.api
7+
8+
import org.openapitools.model.Order
9+
import org.springframework.http.HttpStatus
10+
import org.springframework.http.MediaType
11+
import org.springframework.http.ResponseEntity
12+
13+
import org.springframework.web.bind.annotation.*
14+
import org.springframework.validation.annotation.Validated
15+
import org.springframework.web.context.request.NativeWebRequest
16+
import org.springframework.beans.factory.annotation.Autowired
17+
18+
import javax.validation.constraints.DecimalMax
19+
import javax.validation.constraints.DecimalMin
20+
import javax.validation.constraints.Email
21+
import javax.validation.constraints.Max
22+
import javax.validation.constraints.Min
23+
import javax.validation.constraints.NotNull
24+
import javax.validation.constraints.Pattern
25+
import javax.validation.constraints.Size
26+
import javax.validation.Valid
27+
28+
import kotlin.collections.List
29+
import kotlin.collections.Map
30+
31+
@RestController
32+
@Validated
33+
interface StoreApi {
34+
35+
36+
@RequestMapping(
37+
method = [RequestMethod.DELETE],
38+
value = ["/store/order/{orderId}"]
39+
)
40+
fun deleteOrder( @PathVariable("orderId") orderId: kotlin.String): ResponseEntity<Unit>
41+
42+
43+
@RequestMapping(
44+
method = [RequestMethod.GET],
45+
value = ["/store/inventory"],
46+
produces = ["application/json"]
47+
)
48+
fun getInventory(): ResponseEntity<Map<String, kotlin.Int>>
49+
50+
51+
@RequestMapping(
52+
method = [RequestMethod.GET],
53+
value = ["/store/order/{orderId}"],
54+
produces = ["application/json"]
55+
)
56+
fun getOrderById(@Min(1) @Max(5) @PathVariable("orderId") orderId: kotlin.Int): ResponseEntity<Order>
57+
58+
59+
@RequestMapping(
60+
method = [RequestMethod.POST],
61+
value = ["/store/order"],
62+
produces = ["application/json"],
63+
consumes = ["application/json"]
64+
)
65+
fun placeOrder( @Valid @RequestBody order: Order): ResponseEntity<Order>
66+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/**
2+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.16.0-SNAPSHOT).
3+
* https://openapi-generator.tech
4+
* Do not edit the class manually.
5+
*/
6+
package org.openapitools.api
7+
8+
import org.openapitools.model.User
9+
import org.springframework.http.HttpStatus
10+
import org.springframework.http.MediaType
11+
import org.springframework.http.ResponseEntity
12+
13+
import org.springframework.web.bind.annotation.*
14+
import org.springframework.validation.annotation.Validated
15+
import org.springframework.web.context.request.NativeWebRequest
16+
import org.springframework.beans.factory.annotation.Autowired
17+
18+
import javax.validation.constraints.DecimalMax
19+
import javax.validation.constraints.DecimalMin
20+
import javax.validation.constraints.Email
21+
import javax.validation.constraints.Max
22+
import javax.validation.constraints.Min
23+
import javax.validation.constraints.NotNull
24+
import javax.validation.constraints.Pattern
25+
import javax.validation.constraints.Size
26+
import javax.validation.Valid
27+
28+
import kotlin.collections.List
29+
import kotlin.collections.Map
30+
31+
@RestController
32+
@Validated
33+
interface UserApi {
34+
35+
36+
@RequestMapping(
37+
method = [RequestMethod.POST],
38+
value = ["/user"],
39+
consumes = ["application/json"]
40+
)
41+
fun createUser( @Valid @RequestBody user: User): ResponseEntity<Unit>
42+
43+
44+
@RequestMapping(
45+
method = [RequestMethod.POST],
46+
value = ["/user/createWithArray"],
47+
consumes = ["application/json"]
48+
)
49+
fun createUsersWithArrayInput( @Valid @RequestBody user: kotlin.collections.List<User>): ResponseEntity<Unit>
50+
51+
52+
@RequestMapping(
53+
method = [RequestMethod.POST],
54+
value = ["/user/createWithList"],
55+
consumes = ["application/json"]
56+
)
57+
fun createUsersWithListInput( @Valid @RequestBody user: kotlin.collections.List<User>): ResponseEntity<Unit>
58+
59+
60+
@RequestMapping(
61+
method = [RequestMethod.DELETE],
62+
value = ["/user/{username}"]
63+
)
64+
fun deleteUser( @PathVariable("username") username: kotlin.String): ResponseEntity<Unit>
65+
66+
67+
@RequestMapping(
68+
method = [RequestMethod.GET],
69+
value = ["/user/{username}"],
70+
produces = ["application/json"]
71+
)
72+
fun getUserByName( @PathVariable("username") username: kotlin.String): ResponseEntity<User>
73+
74+
75+
@RequestMapping(
76+
method = [RequestMethod.GET],
77+
value = ["/user/login"],
78+
produces = ["application/json"]
79+
)
80+
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>
81+
82+
83+
@RequestMapping(
84+
method = [RequestMethod.GET],
85+
value = ["/user/logout"]
86+
)
87+
fun logoutUser(): ResponseEntity<Unit>
88+
89+
90+
@RequestMapping(
91+
method = [RequestMethod.PUT],
92+
value = ["/user/{username}"],
93+
consumes = ["application/json"]
94+
)
95+
fun updateUser( @PathVariable("username") username: kotlin.String, @Valid @RequestBody user: User): ResponseEntity<Unit>
96+
}

0 commit comments

Comments
 (0)