@@ -236,6 +236,11 @@ public void processOpts() {
236
236
LOGGER .info ("`library` option is empty. Default to {}" , DEFAULT_LIBRARY );
237
237
}
238
238
239
+ if (isKtor ()) {
240
+ typeMapping .put ("date-time" , "kotlin.String" );
241
+ typeMapping .put ("DateTime" , "kotlin.String" );
242
+ }
243
+
239
244
if (additionalProperties .containsKey (Constants .AUTOMATIC_HEAD_REQUESTS )) {
240
245
setAutoHeadFeatureEnabled (convertPropertyToBooleanAndWriteBack (Constants .AUTOMATIC_HEAD_REQUESTS ));
241
246
} else {
@@ -298,6 +303,8 @@ public void processOpts() {
298
303
supportingFiles .add (new SupportingFile ("gradle.properties" , "" , "gradle.properties" ));
299
304
300
305
if (isKtor ()) {
306
+ additionalProperties .put (Constants .IS_KTOR , true );
307
+
301
308
supportingFiles .add (new SupportingFile ("AppMain.kt.mustache" , packageFolder , "AppMain.kt" ));
302
309
supportingFiles .add (new SupportingFile ("Configuration.kt.mustache" , packageFolder , "Configuration.kt" ));
303
310
@@ -365,6 +372,7 @@ public static class Constants {
365
372
public static final String USE_MUTINY_DESC = "Whether to use Mutiny (should not be used with useCoroutines). This option is currently supported only when using jaxrs-spec library." ;
366
373
public static final String OMIT_GRADLE_WRAPPER = "omitGradleWrapper" ;
367
374
public static final String OMIT_GRADLE_WRAPPER_DESC = "Whether to omit Gradle wrapper for creating a sub project." ;
375
+ public static final String IS_KTOR = "isKtor" ;
368
376
}
369
377
370
378
@ Override
@@ -386,6 +394,13 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
386
394
if (operations != null && !Objects .equals (library , Constants .JAXRS_SPEC )) {
387
395
List <CodegenOperation > ops = operations .getOperation ();
388
396
ops .forEach (operation -> {
397
+ if (isKtor ()) {
398
+ ArrayList <CodegenParameter > params = new ArrayList <>();
399
+ params .addAll (operation .pathParams );
400
+ params .addAll (operation .queryParams );
401
+ operation .vendorExtensions .put ("ktor-params" , params );
402
+ }
403
+
389
404
List <CodegenResponse > responses = operation .responses ;
390
405
if (responses != null ) {
391
406
responses .forEach (resp -> {
0 commit comments