Skip to content
New issue

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

[BUG] for kotlin okhttp client ".value" is being added after paramName for default values of List<Enum> type #13344

Open
4 of 6 tasks
Rattenkrieg opened this issue Sep 4, 2022 · 1 comment

Comments

@Rattenkrieg
Copy link
Contributor

Description

Followup for #13243

It appears there is a bug in okhttp templates or some upstream code: ".value" is being added after paramName when isEnum set to true. This happens even if type of paramName being collection containing enum values. So I guess there has to be some combination of isEnum and isContainer conditionals. 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 2a007b3

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

@Rattenkrieg Rattenkrieg changed the title [BUG] Description [BUG] for kotlin okhttp client ".value" is being added after paramName for default values of List<Enum> type Sep 4, 2022
@drachim-dev
Copy link

drachim-dev commented Dec 13, 2022

I think I have the same issue. For me it generates invalid code because enum is nullable and no safe call is used:
"nullableEnumParam" to PartConfig(body = nullableEnumParam.value, headers = mutableMapOf()),)

using openapi-generator-cli 6.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants