Skip to content

Commit cdbf48a

Browse files
author
andrewwilsonnew
committed
cleanup 3
1 parent 7d5f4ff commit cdbf48a

19 files changed

Lines changed: 54 additions & 609 deletions

File tree

bin/configs/kotlin-misk-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ additionalProperties:
1414
actionParentClass: "WebAction"
1515
actionRequestContentType: "@RequestContentType"
1616
actionRequestContentTypePrefix: "MediaTypes"
17-
testingModule: ""
17+
testingModule: "misk.web.MiskWebModule"

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinMiskServerCodegen.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public class KotlinMiskServerCodegen extends AbstractKotlinCodegen implements Be
6262
public static final String ACTION_REQUEST_CONTENT_TYPE = "actionRequestContentType";
6363
public static final String ACTION_REQUEST_CONTENT_TYPE_PREFIX = "actionRequestContentTypePrefix";
6464
public static final String TESTING_MODULE = "testingModule";
65+
private static final String TESTING_MODULE_NAME = "testingModuleName";
6566

6667
private boolean useBeanValidation = true;
6768

@@ -197,6 +198,7 @@ public void processOpts() {
197198
convertPropertyToStringAndWriteBack(ACTION_REQUEST_CONTENT_TYPE, this::setActionRequestContentType);
198199
convertPropertyToStringAndWriteBack(ACTION_REQUEST_CONTENT_TYPE_PREFIX, this::setActionRequestContentTypePrefix);
199200
convertPropertyToStringAndWriteBack(TESTING_MODULE, this::setTestingModule);
201+
writePropertyBack(TESTING_MODULE_NAME, getTestingModuleName());
200202
convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION, this::setUseBeanValidation);
201203
convertPropertyToBooleanAndWriteBack(GENERATE_STUB_IMPL_CLASSES, this::setGenerateStubImplClasses);
202204
convertPropertyToBooleanAndWriteBack(ADD_MODEL_MOSHI_JSON_ANNOTATION, this::setAddModelMoshiJsonAnnotation);
@@ -248,8 +250,7 @@ private String mapMediaType(String mediaType) {
248250
}
249251

250252
public String getTestingModuleName() {
251-
System.out.println("***" + testingModule.substring(testingModule.lastIndexOf(".")));
252-
return testingModule.substring(testingModule.lastIndexOf("."));
253+
return testingModule.substring(testingModule.lastIndexOf(".")+1);
253254
}
254255

255256
private final static Map<String, String> MEDIA_MAPPING = getMappings();

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

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

33
import jakarta.inject.Inject
44
import jakarta.inject.Singleton
5-
import jakarta.validation.Valid
6-
import jakarta.validation.constraints.DecimalMax
7-
import jakarta.validation.constraints.DecimalMin
8-
import jakarta.validation.constraints.Email
9-
import jakarta.validation.constraints.Max
10-
import jakarta.validation.constraints.Min
11-
import jakarta.validation.constraints.NotNull
12-
import jakarta.validation.constraints.Pattern
13-
import jakarta.validation.constraints.Size
145
import misk.web.Delete
156
import misk.web.Description
167
import misk.web.Get
@@ -42,16 +33,16 @@ class PetApiAction @Inject constructor(
4233
@RequestContentType(MediaTypes.APPLICATION_JSON, MediaTypes.APPLICATION_XML)
4334
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
4435
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
45-
@Supress("unused")
36+
@Suppress("unused")
4637
fun addPet(
47-
@Valid @RequestBody pet: Pet): Pet {
38+
@RequestBody pet: Pet): Pet {
4839
TODO()
4940
}
5041

5142
@Delete("samplePrefix/pet/{petId}")
5243
@Description("Deletes a pet")
5344
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
54-
@Supress("unused")
45+
@Suppress("unused")
5546
fun deletePet(
5647
@PathParam("petId") petId: kotlin.Long,
5748
@RequestHeader(value = "api_key") apiKey: kotlin.String?) {
@@ -62,7 +53,7 @@ class PetApiAction @Inject constructor(
6253
@Description("Finds Pets by status")
6354
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
6455
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
65-
@Supress("unused")
56+
@Suppress("unused")
6657
fun findPetsByStatus(
6758
@QueryParam(value = "status") status: kotlin.Array<kotlin.String>): kotlin.Array<Pet> {
6859
TODO()
@@ -72,7 +63,7 @@ class PetApiAction @Inject constructor(
7263
@Description("Finds Pets by tags")
7364
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
7465
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
75-
@Supress("unused")
66+
@Suppress("unused")
7667
fun findPetsByTags(
7768
@QueryParam(value = "tags") tags: kotlin.Array<kotlin.String>): kotlin.Array<Pet> {
7869
TODO()
@@ -82,7 +73,7 @@ class PetApiAction @Inject constructor(
8273
@Description("Find pet by ID")
8374
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
8475
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
85-
@Supress("unused")
76+
@Suppress("unused")
8677
fun getPetById(
8778
@PathParam("petId") petId: kotlin.Long): Pet {
8879
TODO()
@@ -93,17 +84,17 @@ class PetApiAction @Inject constructor(
9384
@RequestContentType(MediaTypes.APPLICATION_JSON, MediaTypes.APPLICATION_XML)
9485
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
9586
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
96-
@Supress("unused")
87+
@Suppress("unused")
9788
fun updatePet(
98-
@Valid @RequestBody pet: Pet): Pet {
89+
@RequestBody pet: Pet): Pet {
9990
TODO()
10091
}
10192

10293
@Post("samplePrefix/pet/{petId}")
10394
@Description("Updates a pet in the store with form data")
10495
@RequestContentType(MediaTypes.APPLICATION_FORM_URLENCODED)
10596
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
106-
@Supress("unused")
97+
@Suppress("unused")
10798
fun updatePetWithForm(
10899
@PathParam("petId") petId: kotlin.Long,
109100
@QueryParam(value = "name") name: kotlin.String? ,
@@ -116,11 +107,11 @@ class PetApiAction @Inject constructor(
116107
@RequestContentType(MediaTypes.FORM_DATA)
117108
@ResponseContentType(MediaTypes.APPLICATION_JSON)
118109
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
119-
@Supress("unused")
110+
@Suppress("unused")
120111
fun uploadFile(
121112
@PathParam("petId") petId: kotlin.Long,
122113
@QueryParam(value = "additionalMetadata") additionalMetadata: kotlin.String? ,
123-
@Valid file: HttpCall): ModelApiResponse {
114+
file: HttpCall): ModelApiResponse {
124115
TODO()
125116
}
126117
}

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

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

33
import jakarta.inject.Inject
44
import jakarta.inject.Singleton
5-
import jakarta.validation.Valid
6-
import jakarta.validation.constraints.DecimalMax
7-
import jakarta.validation.constraints.DecimalMin
8-
import jakarta.validation.constraints.Email
9-
import jakarta.validation.constraints.Max
10-
import jakarta.validation.constraints.Min
11-
import jakarta.validation.constraints.NotNull
12-
import jakarta.validation.constraints.Pattern
13-
import jakarta.validation.constraints.Size
145
import misk.web.Delete
156
import misk.web.Description
167
import misk.web.Get
@@ -39,7 +30,7 @@ class StoreApiAction @Inject constructor(
3930
@Delete("samplePrefix/store/order/{orderId}")
4031
@Description("Delete purchase order by ID")
4132
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
42-
@Supress("unused")
33+
@Suppress("unused")
4334
fun deleteOrder(
4435
@PathParam("orderId") orderId: kotlin.String) {
4536
TODO()
@@ -49,7 +40,7 @@ class StoreApiAction @Inject constructor(
4940
@Description("Returns pet inventories by status")
5041
@ResponseContentType(MediaTypes.APPLICATION_JSON)
5142
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
52-
@Supress("unused")
43+
@Suppress("unused")
5344
fun getInventory(): kotlin.collections.Map<kotlin.String, kotlin.Int> {
5445
TODO()
5546
}
@@ -58,9 +49,9 @@ class StoreApiAction @Inject constructor(
5849
@Description("Find purchase order by ID")
5950
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
6051
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
61-
@Supress("unused")
52+
@Suppress("unused")
6253
fun getOrderById(
63-
@Min(1L) @Max(5L) @PathParam("orderId") orderId: kotlin.Long): Order {
54+
@PathParam("orderId") orderId: kotlin.Long): Order {
6455
TODO()
6556
}
6657

@@ -69,9 +60,9 @@ class StoreApiAction @Inject constructor(
6960
@RequestContentType(MediaTypes.APPLICATION_JSON)
7061
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
7162
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
72-
@Supress("unused")
63+
@Suppress("unused")
7364
fun placeOrder(
74-
@Valid @RequestBody order: Order): Order {
65+
@RequestBody order: Order): Order {
7566
TODO()
7667
}
7768
}

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

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ package org.openapitools.server.api.api
22

33
import jakarta.inject.Inject
44
import jakarta.inject.Singleton
5-
import jakarta.validation.Valid
6-
import jakarta.validation.constraints.DecimalMax
7-
import jakarta.validation.constraints.DecimalMin
8-
import jakarta.validation.constraints.Email
9-
import jakarta.validation.constraints.Max
10-
import jakarta.validation.constraints.Min
11-
import jakarta.validation.constraints.NotNull
12-
import jakarta.validation.constraints.Pattern
13-
import jakarta.validation.constraints.Size
145
import misk.web.Delete
156
import misk.web.Description
167
import misk.web.Get
@@ -40,36 +31,36 @@ class UserApiAction @Inject constructor(
4031
@Description("Create user")
4132
@RequestContentType(MediaTypes.APPLICATION_JSON)
4233
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
43-
@Supress("unused")
34+
@Suppress("unused")
4435
fun createUser(
45-
@Valid @RequestBody user: User) {
36+
@RequestBody user: User) {
4637
TODO()
4738
}
4839

4940
@Post("samplePrefix/user/createWithArray")
5041
@Description("Creates list of users with given input array")
5142
@RequestContentType(MediaTypes.APPLICATION_JSON)
5243
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
53-
@Supress("unused")
44+
@Suppress("unused")
5445
fun createUsersWithArrayInput(
55-
@Valid @RequestBody user: kotlin.Array<User>) {
46+
@RequestBody user: kotlin.Array<User>) {
5647
TODO()
5748
}
5849

5950
@Post("samplePrefix/user/createWithList")
6051
@Description("Creates list of users with given input array")
6152
@RequestContentType(MediaTypes.APPLICATION_JSON)
6253
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
63-
@Supress("unused")
54+
@Suppress("unused")
6455
fun createUsersWithListInput(
65-
@Valid @RequestBody user: kotlin.Array<User>) {
56+
@RequestBody user: kotlin.Array<User>) {
6657
TODO()
6758
}
6859

6960
@Delete("samplePrefix/user/{username}")
7061
@Description("Delete user")
7162
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
72-
@Supress("unused")
63+
@Suppress("unused")
7364
fun deleteUser(
7465
@PathParam("username") username: kotlin.String) {
7566
TODO()
@@ -79,7 +70,7 @@ class UserApiAction @Inject constructor(
7970
@Description("Get user by user name")
8071
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
8172
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
82-
@Supress("unused")
73+
@Suppress("unused")
8374
fun getUserByName(
8475
@PathParam("username") username: kotlin.String): User {
8576
TODO()
@@ -89,7 +80,7 @@ class UserApiAction @Inject constructor(
8980
@Description("Logs user into the system")
9081
@ResponseContentType(MediaTypes.APPLICATION_XML, MediaTypes.APPLICATION_JSON)
9182
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
92-
@Supress("unused")
83+
@Suppress("unused")
9384
fun loginUser(
9485
@QueryParam(value = "username") username: kotlin.String,
9586
@QueryParam(value = "password") password: kotlin.String): kotlin.String {
@@ -99,7 +90,7 @@ class UserApiAction @Inject constructor(
9990
@Get("samplePrefix/user/logout")
10091
@Description("Logs out current logged in user session")
10192
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
102-
@Supress("unused")
93+
@Suppress("unused")
10394
fun logoutUser() {
10495
TODO()
10596
}
@@ -108,10 +99,10 @@ class UserApiAction @Inject constructor(
10899
@Description("Updated user")
109100
@RequestContentType(MediaTypes.APPLICATION_JSON)
110101
@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0)
111-
@Supress("unused")
102+
@Suppress("unused")
112103
fun updateUser(
113104
@PathParam("username") username: kotlin.String,
114-
@Valid @RequestBody user: User) {
105+
@RequestBody user: User) {
115106
TODO()
116107
}
117108
}

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

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)