swagger-api / swagger-api/swagger-parser
Warn on formdata parameters with no matching content type
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
This is a joint issue with https://github.com/swagger-api/swagger-codegen/issues/4853
formData parameters require a Content-Type set to multipart/form-data or application/x-www-form-urlencoded. The client generator assumes that application/json is a reasonable default when the API doesn't contain a consumes directive.
This means that it's easy to write an API that simply doesn't work.
The parser does not emit an error in this case. Neither does the code generator.
Since there are two options with different tradeoffs for the content type, it may not be appropriate for the code generator to intuit an appropriate content type. Since this is a facet of HTTP instead of a specific codegen target, it's probably appropriate for the parser to emit a warning here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the parser's handling of formData parameters and the consumes directive; the issue does not name specific files or tests. Confirm how missing or incompatible content types are currently handled, then add coverage showing that the parser emits a warning without choosing a content type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100