Skip to content

Commit 3c09ceb

Browse files
author
andrewwilsonnew
committed
fixing return types
1 parent 98705f9 commit 3c09ceb

11 files changed

Lines changed: 24 additions & 103 deletions

File tree

modules/openapi-generator/src/main/resources/kotlin-misk/apiController.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import okhttp3.Headers
4747
@RequestContentType({{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}){{/hasConsumes}}{{#hasProduces}}
4848
@ResponseContentType({{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}){{/hasProduces}}
4949
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
50-
fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}) {
50+
fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{^-last}},{{/-last}}{{/allParams}}){{#returnType}}: {{{returnType}}}{{/returnType}} {
5151
TODO()
5252
}
5353
{{/operation}}

modules/openapi-generator/src/main/resources/kotlin-misk/api_test.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package {{package}}
44
{{/imports}}
55
import jakarta.inject.Inject
66
import misk.testing.MiskTest
7+
import okhttp3.Headers
78

89
import org.junit.jupiter.api.Test
910

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationCore}}{{/useBeanValidation}} {{{paramName}}}: Headers{{/isHeaderParam}}
1+
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationCore}}{{/useBeanValidation}}{{{paramName}}}: Headers{{/isHeaderParam}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{^isFile}}{{{dataType}}}{{^required}}{{^defaultValue}}?{{/defaultValue}}{{/required}}{{/isFile}}{{#isFile}}{{#isArray}}Array<{{/isArray}}HttpCall{{#isArray}}>{{/isArray}}{{^isArray}}{{^required}}{{/required}}{{/isArray}}{{/isFile}}
1+
{{^isFile}}{{{dataType}}}{{^required}}{{^defaultValue}}?{{/defaultValue}}{{/required}}{{/isFile}}{{#isFile}}{{#isArray}}Array<{{/isArray}}Headers{{#isArray}}>{{/isArray}}{{^isArray}}{{^required}}{{/required}}{{/isArray}}{{/isFile}}

samples/server/petstore/kotlin-misk/.openapi-generator/FILES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ src/main/kotlin/org/openapitools/server/api/model/Order.kt
2020
src/main/kotlin/org/openapitools/server/api/model/Pet.kt
2121
src/main/kotlin/org/openapitools/server/api/model/Tag.kt
2222
src/main/kotlin/org/openapitools/server/api/model/User.kt
23+
src/test/kotlin/org/openapitools/server/api/api/PetApiTest.kt
24+
src/test/kotlin/org/openapitools/server/api/api/StoreApiTest.kt
25+
src/test/kotlin/org/openapitools/server/api/api/UserApiTest.kt

samples/server/petstore/kotlin-misk/src/main/kotlin/org/openapitools/server/api/api/PetApiController.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,38 +43,38 @@ import okhttp3.Headers
4343
@RequestContentType(MediaTypes.APPLICATION_JSON, MediaTypes.APPLICATION_XML)
4444
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
4545
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
46-
fun addPet(@Valid @RequestBody pet: Pet) {
46+
fun addPet(@Valid @RequestBody pet: Pet): Pet {
4747
TODO()
4848
}
4949

5050
@Delete("/pet/{petId}")
5151
@Description("Deletes a pet")
5252
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
53-
fun deletePet( @PathParam("petId") petId: kotlin.Long, apiKey: Headers) {
53+
fun deletePet( @PathParam("petId") petId: kotlin.Long,apiKey: Headers) {
5454
TODO()
5555
}
5656

5757
@Get("/pet/findByStatus")
5858
@Description("Finds Pets by status")
5959
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
6060
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
61-
fun findPetsByStatus( @QueryParam(value = "status") status: kotlin.Array<kotlin.String>) {
61+
fun findPetsByStatus( @QueryParam(value = "status") status: kotlin.Array<kotlin.String>): kotlin.Array<Pet> {
6262
TODO()
6363
}
6464

6565
@Get("/pet/findByTags")
6666
@Description("Finds Pets by tags")
6767
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
6868
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
69-
fun findPetsByTags( @QueryParam(value = "tags") tags: kotlin.Array<kotlin.String>) {
69+
fun findPetsByTags( @QueryParam(value = "tags") tags: kotlin.Array<kotlin.String>): kotlin.Array<Pet> {
7070
TODO()
7171
}
7272

7373
@Get("/pet/{petId}")
7474
@Description("Find pet by ID")
7575
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
7676
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
77-
fun getPetById( @PathParam("petId") petId: kotlin.Long) {
77+
fun getPetById( @PathParam("petId") petId: kotlin.Long): Pet {
7878
TODO()
7979
}
8080

@@ -83,7 +83,7 @@ import okhttp3.Headers
8383
@RequestContentType(MediaTypes.APPLICATION_JSON, MediaTypes.APPLICATION_XML)
8484
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
8585
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
86-
fun updatePet(@Valid @RequestBody pet: Pet) {
86+
fun updatePet(@Valid @RequestBody pet: Pet): Pet {
8787
TODO()
8888
}
8989

@@ -100,7 +100,7 @@ import okhttp3.Headers
100100
@RequestContentType(MediaTypes.APPLICATION_OCTETSTREAM /* unknown -> multipart/form-data */ )
101101
@ResponseContentType(MediaTypes.APPLICATION_JSON)
102102
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
103-
fun uploadFile( @PathParam("petId") petId: kotlin.Long,@Valid@QueryParam("additionalMetadata") additionalMetadata: kotlin.String?,) {
103+
fun uploadFile( @PathParam("petId") petId: kotlin.Long,@Valid@QueryParam("additionalMetadata") additionalMetadata: kotlin.String?,): ModelApiResponse {
104104
TODO()
105105
}
106106
}

samples/server/petstore/kotlin-misk/src/main/kotlin/org/openapitools/server/api/api/StoreApiController.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ import okhttp3.Headers
4848
@Description("Returns pet inventories by status")
4949
@ResponseContentType(MediaTypes.APPLICATION_JSON)
5050
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
51-
fun getInventory() {
51+
fun getInventory(): kotlin.collections.Map<kotlin.String, kotlin.Int> {
5252
TODO()
5353
}
5454

5555
@Get("/store/order/{orderId}")
5656
@Description("Find purchase order by ID")
5757
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
5858
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
59-
fun getOrderById(@Min(1L) @Max(5L) @PathParam("orderId") orderId: kotlin.Long) {
59+
fun getOrderById(@Min(1L) @Max(5L) @PathParam("orderId") orderId: kotlin.Long): Order {
6060
TODO()
6161
}
6262

@@ -65,7 +65,7 @@ import okhttp3.Headers
6565
@RequestContentType(MediaTypes.APPLICATION_JSON)
6666
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
6767
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
68-
fun placeOrder(@Valid @RequestBody order: Order) {
68+
fun placeOrder(@Valid @RequestBody order: Order): Order {
6969
TODO()
7070
}
7171
}

samples/server/petstore/kotlin-misk/src/main/kotlin/org/openapitools/server/api/api/UserApiController.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ import okhttp3.Headers
7272
@Description("Get user by user name")
7373
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
7474
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
75-
fun getUserByName( @PathParam("username") username: kotlin.String) {
75+
fun getUserByName( @PathParam("username") username: kotlin.String): User {
7676
TODO()
7777
}
7878

7979
@Get("/user/login")
8080
@Description("Logs user into the system")
8181
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
8282
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
83-
fun loginUser( @QueryParam(value = "username") username: kotlin.String, @QueryParam(value = "password") password: kotlin.String) {
83+
fun loginUser( @QueryParam(value = "username") username: kotlin.String, @QueryParam(value = "password") password: kotlin.String): kotlin.String {
8484
TODO()
8585
}
8686

samples/server/petstore/kotlin-misk/src/test/kotlin/org/openapitools/server/api/api/PetApiTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import org.openapitools.server.api.model.ModelApiResponse
44
import org.openapitools.server.api.model.Pet
55
import jakarta.inject.Inject
66
import misk.testing.MiskTest
7+
import okhttp3.Headers
78

89
import org.junit.jupiter.api.Test
910

@@ -85,7 +86,7 @@ internal class PetApiTest {
8586
fun `should handle uploadFile`() {
8687
val petId: kotlin.Long = TODO()
8788
val additionalMetadata: kotlin.String? = TODO()
88-
val file: HttpCall = TODO()
89+
val file: Headers = TODO()
8990
val response: ModelApiResponse = PetApi.uploadFile(petId, additionalMetadata, file)
9091
}
9192

samples/server/petstore/kotlin-misk/src/test/kotlin/org/openapitools/server/api/api/StoreApiTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
2+
13
package org.openapitools.server.api.api
24

35
import org.openapitools.server.api.model.Order
46
import jakarta.inject.Inject
57
import misk.testing.MiskTest
8+
import okhttp3.Headers
69

710
import org.junit.jupiter.api.Test
811

0 commit comments

Comments
 (0)