Skip to content

Commit 22c1439

Browse files
committed
Handle implicit headers KotlinMiskServerCodegen, KotlinSpringServerCodegen and KotlinServerCodegen
1 parent 58e05ce commit 22c1439

5 files changed

Lines changed: 10 additions & 6 deletions

File tree

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
@@ -258,7 +258,6 @@ public void processOpts() {
258258
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) {
259259
OperationMap objectMap = objs.getOperations();
260260
List<CodegenOperation> operations = objectMap.getOperation();
261-
262261
for (CodegenOperation operation : operations) {
263262

264263
if (operation.hasConsumes) {
@@ -277,6 +276,8 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
277276
operation.httpMethod = camelize(operation.httpMethod.toLowerCase(Locale.ROOT));
278277
}
279278

279+
handleImplicitHeaders(objs);
280+
280281
return objs;
281282
}
282283

@@ -330,4 +331,4 @@ private static Map<String, String> getMappings() {
330331

331332
return result;
332333
}
333-
}
334+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,8 @@ public void setReturnContainer(final String returnContainer) {
786786
});
787787
}
788788

789+
handleImplicitHeaders(objs);
790+
789791
return objs;
790792
}
791793

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,10 +1317,6 @@ public void setReturnContainer(final String returnContainer) {
13171317
}
13181318
}
13191319
}
1320-
1321-
// if(implicitHeaders){
1322-
// removeHeadersFromAllParams(operation.allParams);
1323-
// }
13241320
});
13251321

13261322
// Add imports for sealed interfaces if feature is enabled
@@ -1345,6 +1341,8 @@ public void setReturnContainer(final String returnContainer) {
13451341
}
13461342
}
13471343

1344+
handleImplicitHeaders(objs);
1345+
13481346
return objs;
13491347
}
13501348

modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/misk/KotlinMiskServerCodegenOptionsTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ protected void verifyOptions() {
4646
verify(codegen).setActionRequestContentTypePrefix(KotlinMiskServerCodegenOptionsProvider.ACTION_REQUEST_CONTENT_TYPE_PREFIX);
4747
verify(codegen).setGenerateStubImplClasses(Boolean.valueOf(KotlinMiskServerCodegenOptionsProvider.GENERATE_STUB_IMPL_CLASSES));
4848
verify(codegen).setAddModelMoshiJsonAnnotation(Boolean.valueOf(KotlinMiskServerCodegenOptionsProvider.ADD_MODEL_MOSHI_JSON_ANNOTATION));
49+
verify(codegen).setImplicitHeaders(Boolean.valueOf(KotlinMiskServerCodegenOptionsProvider.IMPLICIT_HEADERS_VALUE));
4950
}
5051
}

modules/openapi-generator/src/test/java/org/openapitools/codegen/options/KotlinMiskServerCodegenOptionsProvider.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class KotlinMiskServerCodegenOptionsProvider implements OptionsProvider {
3333
public static final String ACTION_REQUEST_CONTENT_TYPE = "contentType<";
3434
public static final String ACTION_REQUEST_CONTENT_TYPE_PREFIX = "contentTypePrefix<";
3535
public static final String TESTING_MODULE = "testingModule";
36+
public static final String IMPLICIT_HEADERS_VALUE = "false";
3637

3738
@Override
3839
public String getLanguage() {
@@ -69,6 +70,7 @@ public Map<String, String> createOptions() {
6970
.put(KotlinMiskServerCodegen.ADD_MODEL_MOSHI_JSON_ANNOTATION, ADD_MODEL_MOSHI_JSON_ANNOTATION)
7071
.put(KotlinMiskServerCodegen.GENERATE_STUB_IMPL_CLASSES, GENERATE_STUB_IMPL_CLASSES)
7172
.put(KotlinMiskServerCodegen.TESTING_MODULE, TESTING_MODULE)
73+
.put(AbstractKotlinCodegen.IMPLICIT_HEADERS, IMPLICIT_HEADERS_VALUE)
7274
.build();
7375
}
7476

0 commit comments

Comments
 (0)