Skip to content

[REQ] Form parameters with additionalProperties #22272

@joelvdw

Description

@joelvdw

Is your feature request related to a problem? Please describe.

I have a POST route in my openapi specification with a form-urlencoded body. The schema of this body is composed of some known properties that are defined, but also should accept other arbitrary properties as a Map that will be passed to the service without prior validation. To do this, I have an object type with the additionalProperties property to true.

Currently, it generates this error :
Form parameters with additionalProperties are not supported by OpenAPI Generator. Please report the issue to https://github.com/openapitools/openapi-generator if you need help.

Describe the solution you'd like

I would like the generator to generate a method signature with the known parameters as classic parameters, with an additional parameter with a Map<String, Object> or Map<String, String> type

public ResponseEntity<ResponseDTO> postRoute(Boolean param1, String param2,
            @RequestParam Map<String, Object> additionalParameters) {
    ...
}

Describe alternatives you've considered

I have not thought of a better way to do this. Currently, I need to remove the @Override modifier because I need this Map.

I can't change the content type or define all the parameters, because I don't control the client that will call this route (a webhook).

Additional context

Here is my openapi specification for the requestBody I need :

  requestBody:
    required: true
    content:
      application/x-www-form-urlencoded:
        schema:
          type: object
          properties:
            param1:
              type: boolean
              default: false
            param2:
               type: string
          additionalProperties: true

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions