openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG] [JAVA] Cannot use oneOf as query parameter

Open lollol155 opened this issue 1 year ago • 1 comments

Bug Report Checklist

  • [x] Have you provided a full/minimal spec to reproduce the issue?
  • [ ] Have you validated the input using an OpenAPI validator (example)?
  • [x] Have you tested with the latest master to confirm the issue still exists?
  • [x] Have you searched for related issues/PRs?
  • [x] What's the actual output vs expected output?
  • [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
openapi-generator version

7.6.0-SNAPSHOT

OpenAPI declaration file content or url
    parameters:
        name: myParameter
        in: query
        required: false
        schema:
          oneOf:
            - type: number
            - type: string

will result in name of openapi class as actual query parameter instead of my string or number

org.openapitools.client.model.myParameter

lollol155 avatar Apr 30 '24 14:04 lollol155

as a workaround, what about simplifying the schema to the following instead?

    parameters:
        name: myParameter
        in: query
        required: false
        schema:
          - type: string

as number and string make no difference in the query parameter in most cases.

wing328 avatar May 08 '24 07:05 wing328