[kotlin]Fix ktor doesn't generate nullable types (#5258)

* If not required, need `? = null`

* run  ./bin/kotlin-server-petstore.sh

* Added `?` when value is `required` and `isNullable`

* Rerun ./bin/kotlin-server-petstore.sh. But No differences
This commit is contained in:
Yutaka Miyamae 2020-03-01 18:58:58 +09:00 committed by GitHub
parent f6f5c9b8b9
commit 015b404729
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ object Paths {
{{#allParams}}* @param {{paramName}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/allParams}}*/
@KtorExperimentalLocationsAPI
@Location("{{path}}") class {{operationId}}({{#allParams}}val {{paramName}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
@Location("{{path}}") class {{operationId}}({{#allParams}}val {{paramName}}: {{{dataType}}}{{^required}}? = null{{/required}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
{{/bodyAllowed}}
{{/operation}}

View File

@ -22,7 +22,7 @@ object Paths {
* @param apiKey (optional)
*/
@KtorExperimentalLocationsAPI
@Location("/pet/{petId}") class deletePet(val petId: kotlin.Long, val apiKey: kotlin.String)
@Location("/pet/{petId}") class deletePet(val petId: kotlin.Long, val apiKey: kotlin.String? = null)
/**
* Finds Pets by status