From 8397e8d9186a6e30d80c9e4fddf94cd9602958d4 Mon Sep 17 00:00:00 2001 From: Clarice Poh Date: Tue, 13 Mar 2018 11:21:49 +1100 Subject: [PATCH] Fixed Ktor Path template to generate nullable value for optional parameters as described in open-api definition --- .../resources/v2/kotlin-server/libraries/ktor/Paths.kt.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/v2/kotlin-server/libraries/ktor/Paths.kt.mustache b/src/main/resources/v2/kotlin-server/libraries/ktor/Paths.kt.mustache index 31ad8269d3..212c2245cd 100644 --- a/src/main/resources/v2/kotlin-server/libraries/ktor/Paths.kt.mustache +++ b/src/main/resources/v2/kotlin-server/libraries/ktor/Paths.kt.mustache @@ -33,7 +33,7 @@ object Paths { * {{#unescapedNotes}}{{.}}{{/unescapedNotes}} {{#allParams}}* @param {{paramName}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}}*/ - @Location("{{path}}") class {{operationId}}({{#allParams}}val {{paramName}}: {{{dataType}}}{{#has this 'more'}}, {{/has}}{{/allParams}}) + @Location("{{path}}") class {{operationId}}({{#allParams}}val {{paramName}}: {{{dataType}}}{{^required}}? = null{{/required}}{{#has this 'more'}}, {{/has}}{{/allParams}}) {{/bodyAllowed}} {{/operation}}