We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The kotlin-client generator when using Retrofit2 library generates a DefaultApi.kt file that doesn't mark optional parameters as nullable.
openapi-generator-cli/4.3.0
openapi: 3.0.0 info: version: 0.0.1 title: Optional Parameter Demo paths: /foo: get: parameters: - in: query name: optional required: false schema: type: integer - in: query name: mandatory required: true schema: type: integer responses: 200: description: '' content: text/plain: schema: type: integer
java -jar .\openapi-generator-cli-4.3.0.jar generate -i ".\foo.yaml" --artifact-id kotlin-client -g kotlin -o generated --library jvm-retrofit2
Result will be:
package org.openapitools.client.apis import org.openapitools.client.infrastructure.CollectionFormats.* import retrofit2.http.* import retrofit2.Call import okhttp3.RequestBody import okhttp3.ResponseBody import okhttp3.MultipartBody interface DefaultApi { @GET("/foo") fun fooGet(@Query("mandatory") mandatory: kotlin.Int, @Query("optional") optional: kotlin.Int): Call<kotlin.Int> }
#5198 #2012
Optional parameter should be @Query("optional") optional: kotlin.Int?
@Query("optional") optional: kotlin.Int?
The text was updated successfully, but these errors were encountered:
[kotlin][retrofit2]fix query parameter nullable OpenAPITools#5859
7f63b55
Successfully merging a pull request may close this issue.
Bug Report Checklist
Description
The kotlin-client generator when using Retrofit2 library generates a DefaultApi.kt file that doesn't mark optional parameters as nullable.
openapi-generator version
openapi-generator-cli/4.3.0
OpenAPI declaration file content or url
Command line used for generation
java -jar .\openapi-generator-cli-4.3.0.jar generate -i ".\foo.yaml" --artifact-id kotlin-client -g kotlin -o generated --library jvm-retrofit2
Steps to reproduce
Result will be:
Related issues/PRs
#5198
#2012
Suggest a fix
Optional parameter should be
@Query("optional") optional: kotlin.Int?
The text was updated successfully, but these errors were encountered: