OpenAPITools / OpenAPITools/openapi-generator
[BUG] for kotlin okhttp client ".value" is being added after paramName for default values of List<Enum> type
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
Followup for #13243
It appears there is a bug in okhttp templates or some upstream code:
".value"is being added afterparamNamewhenisEnumset to true. This happens even if type ofparamNamebeing collection containing enum values. So I guess there has to be some combination ofisEnumandisContainerconditionals. I'm not that proficient in mustache templating so I guess better I could do is to open a dedicated issue. For sake of this PR I've changed values in api spec from list of enums to list of strings.
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
openapi-generator version
6.0.1
commit https://github.com/OpenAPITools/openapi-generator/commit/2a007b3465e6bddadf2ecb04cf2fa11229a1ed4d
OpenAPI declaration file content or url
/foo/bar:
post:
operationId: UpdateBar
consumes:
- multipart/form-data
parameters:
- name: values
in: formData
required: false
type: array
items:
type: string
enum: # note enum here
- value1
- value2
default:
- value1
responses:
"200":
description: "Success."
Related issues/PRs
#13243
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
Inspect modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-okhttp/api.mustache around line 192, then generate a Kotlin JVM OkHttp client from the provided OpenAPI formData example. Verify that a default List parameter is handled without appending ".value" to the collection parameter, while preserving enum handling for non-collection values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, openapi
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100