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
21.58k stars 6.52k forks source link

[BUG][JAVA][Spring] Form passing with application/x-www-form-urlencoded uses @RequestPart instead of @RequestParam #7794

Open osimosu opened 3 years ago

osimosu commented 3 years ago

Bug Report Checklist

Description

Using application/x-www-form-urlencoded as the requestbody generates spring methods with @RequestParts instead of @RequestParam

More info: https://github.com/swagger-api/swagger-codegen/issues/6438

openapi-generator version

5.0.0-beta2

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  title: 'app'
  version: 0.0.1
servers:
  - url: http://localhost:8080/api
    description: Development server
paths:
  /authorize:
    post:
      summary: Authorization Endpoint
      operationId: authorize
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                grant_type:
                  type: string
Generation Details

I'm generating the server code with openapi-generator-maven-plugin .

Suggest a fix

Use @RequestParam for application/x-www-form-urlencoded instead of @RequestPart since it's not a file

osimosu commented 3 years ago

This seems to have been introduced starting 4.3.0. It generated @RequestParam using 4.2.3.