You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[REQ][kotlin] Add = null default for optional parameters in jvm-ktor client and javalin server templates #23100
Is your feature request related to a problem? Please describe.
Several Kotlin generator templates make optional parameters nullable (Type?) but don't assign = null as a default value. This forces callers to explicitly pass null for every optional parameter instead of simply
omitting them — defeating the purpose of Kotlin's default parameter feature.
For example, the generated jvm-ktor client produces:
Callers must write deletePet(123, null) instead of just deletePet(123).
Most templates already handle this correctly (jvm-okhttp, jvm-retrofit2, jvm-spring-restclient, jvm-spring-webclient, jvm-vertx, jvm-volley, multiplatform, and all data_class_opt_var.mustache model templates).
The following templates are inconsistent:
Add = null (or = {{{defaultValue}}} when a default is specified) for optional parameters in the affected templates, matching the pattern already used by multiplatform/api.mustache and jvm-okhttp/api.mustache.
The generated output would then be:
Manually wrapping every generated API class with extension functions that provide default values. This is tedious and breaks every time the API is regenerated.
Additional context
This is a consistency fix — the majority of Kotlin templates already emit = null for optional params. Only jvm-ktor (client) and javalin5/javalin6 (server) are missing it.
Activity
[kotlin] Add = null default for optional parameters in jvm-ktor and j…
[kotlin] Add = null default for optional parameters in jvm-ktor and j…