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

[BUG] Java: Not able to pass dictionary in query parameters

Open siddhsql opened this issue 1 year ago • 0 comments

Bug Report Checklist

  • [x] Have you provided a full/minimal spec to reproduce the issue?
  • [ x] 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?
  • [ x] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

I want to be able to pass a dictionary in the query params of an endpoint. To do this, I created following spec as example:

- name: metadata
          in: query
          required: false
          style: deepObject
          explode: true
          schema:
            type: object
            additionalProperties:
              type: string      

There are 3 issues (bugs) I am facing:

when I run the openapi-codegenerator (I am running it via Maven plugin) ISSUE 1: it produces the same output irrespective of whether

          style: deepObject
          explode: true

is present or not in the yaml file. The generated Java code is this:

@Parameter(name = "metadata", description = "", in = ParameterIn.QUERY)
          @Valid
          @RequestParam(value = "", required = false)
          Map<String, String> metadata

Further in swagger-ui ISSUE 2: I do not see any UI element corresponding to the metadata variable in above.

I am using openapi: 3.0.1

ISSUE 3: my Spring boot endpoint is like this:

public ResponseEntity<Void> foo(
      String s1, String s2, Map<String, String> map, SomeEnum someEnum) {

Expected: map should not contain s1, s2, someEnum

Observed: map contains s1, s2, someEnum

openapi-generator version

7.4.0

Generation Details
Steps to reproduce
Related issues/PRs

I am not sure if this is same issue as this. Reading that issue it seemed like it is w.r.t. client code whereas my issue is w.r.t. server code.

siddhsql avatar Jun 25 '24 17:06 siddhsql