swagger-api / swagger-api/swagger-codegen
[Kotlin] Support optional method parameters in codegen
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Method parameters defined as required = false in API definition do not generate client methods which allow no value to be passed.
Swagger-codegen version
HEAD
Steps to reproduce
- Generate Kotlin client for API with optional fields in a method.
Expected Results: Corresponding Kotlin code will allow null to be passed to optional parameter.
Actual Results: Kotlin code requires value to be specified for optional parameter.
Related issues/PRs
Similar feature addition to Scala: https://github.com/swagger-api/swagger-codegen/pull/3677/commits/f12f70d62d73ab73283784aa7c34188dcb939641
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by generating a Kotlin client for an API with a method parameter marked required = false, then inspect the generated method signature and compare the related Scala change in PR 3677. Done means the generated Kotlin client allows the optional parameter to be omitted or passed as null instead of requiring a value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100