swagger-api / swagger-api/swagger-codegen

[BUG] Broken Form @RequestPart should not be used for key-value property

Open
#6,438 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Looks like passing formData with "application/x-www-form-urlencoded" never work.

As per documentation https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/bind/annotation/RequestPart.html @RequestParam should be used instead of @RequestPart if not file.
https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/JavaSpring/formParams.mustache

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with modules/swagger-codegen/src/main/resources/JavaSpring/formParams.mustache and compare its generated handling of key-value form fields with the linked Spring documentation. Verify the generated Java Spring code for application/x-www-form-urlencoded forms uses @RequestParam rather than @RequestPart for non-file properties, and confirm the resulting template behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.