OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
20.51k stars 6.27k forks source link

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

Open siddhsql opened 3 days ago

siddhsql commented 3 days ago

Bug Report Checklist

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.