swagger-api / swagger-api/swagger-codegen

Consumes = "" generated from yaml file after version 2.3.0

Open
#8,298 0 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

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.