Skip to content

Commit f5d4d40

Browse files
author
andrewwilsonnew
committed
fixup
1 parent 93a5550 commit f5d4d40

10 files changed

Lines changed: 65 additions & 18 deletions

File tree

samples/server/petstore/kotlin-misk/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ version = "1.0.0-SNAPSHOT"
1010
dependencies {
1111
implementation("jakarta.validation:jakarta.validation-api:3.1.1")
1212
implementation("com.squareup.misk:misk:2025.04.02.195630-a61d550")
13+
implementation("com.squareup.moshi:moshi:1.15.2")
1314
//implementation("com.squareup.wire:wire-runtime:5.2.1")
1415

1516
testImplementation("com.squareup.misk:misk-testing:2025.02.11.123913-8a41324")

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

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ import misk.web.mediatype.MediaTypes
3030
import org.openapitools.server.api.model.ModelApiResponse
3131
import org.openapitools.server.api.model.Pet
3232

33+
/**
34+
* @TODO("Fill out implementation")
35+
*/
3336
@Singleton
3437
class PetApiAction @Inject constructor(
3538
private val petApi: PetApi
@@ -40,38 +43,44 @@ class PetApiAction @Inject constructor(
4043
@RequestContentType(MediaTypes.APPLICATION_JSON, MediaTypes.APPLICATION_XML)
4144
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
4245
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
43-
override fun addPet(@Valid @RequestBody pet: Pet): Pet {
46+
override fun addPet(
47+
@Valid @RequestBody pet: Pet): Pet {
4448
TODO()
4549
}
4650

4751
@Delete("/pet/{petId}")
4852
@Description("Deletes a pet")
4953
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
50-
override fun deletePet(@PathParam("petId") petId: kotlin.Long, @RequestHeader(value = "api_key") apiKey: kotlin.String?) {
54+
override fun deletePet(
55+
@PathParam("petId") petId: kotlin.Long,
56+
@RequestHeader(value = "api_key") apiKey: kotlin.String?) {
5157
TODO()
5258
}
5359

5460
@Get("/pet/findByStatus")
5561
@Description("Finds Pets by status")
5662
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
5763
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
58-
override fun findPetsByStatus( @QueryParam(value = "status") status: kotlin.Array<kotlin.String>): kotlin.Array<Pet> {
64+
override fun findPetsByStatus(
65+
@QueryParam(value = "status") status: kotlin.Array<kotlin.String>): kotlin.Array<Pet> {
5966
TODO()
6067
}
6168

6269
@Get("/pet/findByTags")
6370
@Description("Finds Pets by tags")
6471
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
6572
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
66-
override fun findPetsByTags( @QueryParam(value = "tags") tags: kotlin.Array<kotlin.String>): kotlin.Array<Pet> {
73+
override fun findPetsByTags(
74+
@QueryParam(value = "tags") tags: kotlin.Array<kotlin.String>): kotlin.Array<Pet> {
6775
TODO()
6876
}
6977

7078
@Get("/pet/{petId}")
7179
@Description("Find pet by ID")
7280
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
7381
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
74-
override fun getPetById(@PathParam("petId") petId: kotlin.Long): Pet {
82+
override fun getPetById(
83+
@PathParam("petId") petId: kotlin.Long): Pet {
7584
TODO()
7685
}
7786

@@ -80,15 +89,19 @@ class PetApiAction @Inject constructor(
8089
@RequestContentType(MediaTypes.APPLICATION_JSON, MediaTypes.APPLICATION_XML)
8190
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
8291
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
83-
override fun updatePet(@Valid @RequestBody pet: Pet): Pet {
92+
override fun updatePet(
93+
@Valid @RequestBody pet: Pet): Pet {
8494
TODO()
8595
}
8696

8797
@Post("/pet/{petId}")
8898
@Description("Updates a pet in the store with form data")
8999
@RequestContentType(MediaTypes.APPLICATION_FORM_URLENCODED)
90100
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
91-
override fun updatePetWithForm(@PathParam("petId") petId: kotlin.Long, @QueryParam(value = "name") name: kotlin.String? , @QueryParam(value = "status") status: kotlin.String? ) {
101+
override fun updatePetWithForm(
102+
@PathParam("petId") petId: kotlin.Long,
103+
@QueryParam(value = "name") name: kotlin.String? ,
104+
@QueryParam(value = "status") status: kotlin.String? ) {
92105
TODO()
93106
}
94107

@@ -97,7 +110,10 @@ class PetApiAction @Inject constructor(
97110
@RequestContentType(MediaTypes.FORM_DATA)
98111
@ResponseContentType(MediaTypes.APPLICATION_JSON)
99112
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
100-
override fun uploadFile(@PathParam("petId") petId: kotlin.Long, @QueryParam(value = "additionalMetadata") additionalMetadata: kotlin.String? , @Valid file: HttpCall): ModelApiResponse {
113+
override fun uploadFile(
114+
@PathParam("petId") petId: kotlin.Long,
115+
@QueryParam(value = "additionalMetadata") additionalMetadata: kotlin.String? ,
116+
@Valid file: HttpCall): ModelApiResponse {
101117
TODO()
102118
}
103119
}

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ import misk.web.interceptors.LogRequestResponse
2929
import misk.web.mediatype.MediaTypes
3030
import org.openapitools.server.api.model.Order
3131

32+
/**
33+
* @TODO("Fill out implementation")
34+
*/
3235
@Singleton
3336
class StoreApiAction @Inject constructor(
3437
private val storeApi: StoreApi
@@ -37,7 +40,8 @@ class StoreApiAction @Inject constructor(
3740
@Delete("/store/order/{orderId}")
3841
@Description("Delete purchase order by ID")
3942
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
40-
override fun deleteOrder(@PathParam("orderId") orderId: kotlin.String) {
43+
override fun deleteOrder(
44+
@PathParam("orderId") orderId: kotlin.String) {
4145
TODO()
4246
}
4347

@@ -53,7 +57,8 @@ class StoreApiAction @Inject constructor(
5357
@Description("Find purchase order by ID")
5458
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
5559
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
56-
override fun getOrderById(@Min(1L) @Max(5L) @PathParam("orderId") orderId: kotlin.Long): Order {
60+
override fun getOrderById(
61+
@Min(1L) @Max(5L) @PathParam("orderId") orderId: kotlin.Long): Order {
5762
TODO()
5863
}
5964

@@ -62,7 +67,8 @@ class StoreApiAction @Inject constructor(
6267
@RequestContentType(MediaTypes.APPLICATION_JSON)
6368
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
6469
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
65-
override fun placeOrder(@Valid @RequestBody order: Order): Order {
70+
override fun placeOrder(
71+
@Valid @RequestBody order: Order): Order {
6672
TODO()
6773
}
6874
}

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

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ import misk.web.interceptors.LogRequestResponse
2929
import misk.web.mediatype.MediaTypes
3030
import org.openapitools.server.api.model.User
3131

32+
/**
33+
* @TODO("Fill out implementation")
34+
*/
3235
@Singleton
3336
class UserApiAction @Inject constructor(
3437
private val userApi: UserApi
@@ -38,46 +41,53 @@ class UserApiAction @Inject constructor(
3841
@Description("Create user")
3942
@RequestContentType(MediaTypes.APPLICATION_JSON)
4043
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
41-
override fun createUser(@Valid @RequestBody user: User) {
44+
override fun createUser(
45+
@Valid @RequestBody user: User) {
4246
TODO()
4347
}
4448

4549
@Post("/user/createWithArray")
4650
@Description("Creates list of users with given input array")
4751
@RequestContentType(MediaTypes.APPLICATION_JSON)
4852
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
49-
override fun createUsersWithArrayInput(@Valid @RequestBody user: kotlin.Array<User>) {
53+
override fun createUsersWithArrayInput(
54+
@Valid @RequestBody user: kotlin.Array<User>) {
5055
TODO()
5156
}
5257

5358
@Post("/user/createWithList")
5459
@Description("Creates list of users with given input array")
5560
@RequestContentType(MediaTypes.APPLICATION_JSON)
5661
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
57-
override fun createUsersWithListInput(@Valid @RequestBody user: kotlin.Array<User>) {
62+
override fun createUsersWithListInput(
63+
@Valid @RequestBody user: kotlin.Array<User>) {
5864
TODO()
5965
}
6066

6167
@Delete("/user/{username}")
6268
@Description("Delete user")
6369
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
64-
override fun deleteUser(@PathParam("username") username: kotlin.String) {
70+
override fun deleteUser(
71+
@PathParam("username") username: kotlin.String) {
6572
TODO()
6673
}
6774

6875
@Get("/user/{username}")
6976
@Description("Get user by user name")
7077
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
7178
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
72-
override fun getUserByName(@PathParam("username") username: kotlin.String): User {
79+
override fun getUserByName(
80+
@PathParam("username") username: kotlin.String): User {
7381
TODO()
7482
}
7583

7684
@Get("/user/login")
7785
@Description("Logs user into the system")
7886
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
7987
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
80-
override fun loginUser( @QueryParam(value = "username") username: kotlin.String, @QueryParam(value = "password") password: kotlin.String): kotlin.String {
88+
override fun loginUser(
89+
@QueryParam(value = "username") username: kotlin.String,
90+
@QueryParam(value = "password") password: kotlin.String): kotlin.String {
8191
TODO()
8292
}
8393

@@ -92,7 +102,9 @@ class UserApiAction @Inject constructor(
92102
@Description("Updated user")
93103
@RequestContentType(MediaTypes.APPLICATION_JSON)
94104
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)
95-
override fun updateUser(@PathParam("username") username: kotlin.String, @Valid @RequestBody user: User) {
105+
override fun updateUser(
106+
@PathParam("username") username: kotlin.String,
107+
@Valid @RequestBody user: User) {
96108
TODO()
97109
}
98110
}

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

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

3+
import com.squareup.moshi.JsonClass
34

5+
@JsonClass(generateAdapter = true)
46
data class Category(
57
val id: kotlin.Long? = null,
68
val name: kotlin.String? = null

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

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

3+
import com.squareup.moshi.JsonClass
34

5+
@JsonClass(generateAdapter = true)
46
data class ModelApiResponse(
57
val code: kotlin.Int? = null,
68
val type: kotlin.String? = null,

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

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

3+
import com.squareup.moshi.JsonClass
34

5+
@JsonClass(generateAdapter = true)
46
data class Order(
57
val id: kotlin.Long? = null,
68
val petId: kotlin.Long? = null,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package org.openapitools.server.api.model
22

33
import org.openapitools.server.api.model.Category
44
import org.openapitools.server.api.model.Tag
5+
import com.squareup.moshi.JsonClass
56

7+
@JsonClass(generateAdapter = true)
68
data class Pet(
79
val name: kotlin.String,
810
val photoUrls: kotlin.Array<kotlin.String>,

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

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

3+
import com.squareup.moshi.JsonClass
34

5+
@JsonClass(generateAdapter = true)
46
data class Tag(
57
val id: kotlin.Long? = null,
68
val name: kotlin.String? = null

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

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

3+
import com.squareup.moshi.JsonClass
34

5+
@JsonClass(generateAdapter = true)
46
data class User(
57
val id: kotlin.Long? = null,
68
val username: kotlin.String? = null,

0 commit comments

Comments
 (0)