-
Notifications
You must be signed in to change notification settings - Fork 11
Description
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