swagger-api / swagger-api/swagger-codegen
Consumes = "" generated from yaml file after version 2.3.0
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
In Get or Delete method, the "consumes" in @RequestMapping is not generated correctly, which will result a compile error if I run the app. When regenerated by version 2.2.3 or below, the mapping works fine.
Swagger-codegen version
2.3.0 && 2.3.1
Swagger declaration file content or url
In Get,
"consumes":[
"*/*"
],
it will produce
consumes = ""
In Delete,
"consumes":[
"*/*"
],
"produces":[
"*/*"
],
it will generate
produces = "*/*",
consumes = ""
In this case, "produces" works fine, but "consumes" doesn't.
Command line used for generation
java -jar swagger-codegen-cli-2.3.1.jar generate -i userprefs-api.json -l spring -o server
Suggest a fix/enhancement
Please compare it with older version 2.2.3
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 running the documented swagger-codegen 2.3.1 command with the provided Swagger declaration and inspect the generated Spring output for GET and DELETE methods. Compare it with output from version 2.2.3, focusing on the consumes and produces mappings; done means consumes is generated correctly and the result compiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100