Skip to content

Support parameter expansion for application/x-www-form-urlencoded similar to multipart/form-data #412

Closed

Description

@phlawski

Description

While using openapi-processor-spring, I noticed an inconsistency in how
multipart/form-data and application/x-www-form-urlencoded request bodies
are handled.

According to the documentation:
https://openapiprocessor.io/spring/processor/requestbody.html#_multipartform_data

Instead of generating a @RequestBody parameter for the object schema the
processor creates a parameter for each property of the object annotated
with @RequestParam

This behavior works very well for multipart/form-data.

However, for application/x-www-form-urlencoded, the processor always generates
a single @RequestBody parameter, even when the request body schema is an
object with simple scalar properties.

In Spring MVC, both multipart/form-data and
application/x-www-form-urlencoded are typically handled as request parameters
(@RequestParam / form fields), not as a raw request body.

This causes issues for common and important use cases such as OAuth2 token
endpoints (/token), where application/x-www-form-urlencoded is required
by the specification.


Expected behavior

For application/x-www-form-urlencoded request bodies with an object schema,
the processor should generate one @RequestParam per property, similar to the
existing behavior for multipart/form-data.

Example OpenAPI:

requestBody:
  content:
    application/x-www-form-urlencoded:
      schema:
        type: object
        properties:
          grant_type:
            type: string
          code:
            type: string

Activity

  1. hauner commented on Jan 15, 2026

    @hauner
    Member

    Yes, it should do that.

    I think it would be nice too if it could drop the @RequestBody, assuming that Spring will nicely fill the parameter object. This would probably need a switch to decide which variant it should generate. I have to test that.

    Thanks for reporting :-)

  2. added this to the 2026.2 milestone on Jan 15, 2026
  3. modified the milestones: 2026.2, 2026.4 on Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions