swagger-api / swagger-api/swagger-codegen
Try out returns status code other than 200 in most of the operations in spring application generated using swagger spec.
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
when i generate a server stub for spring application using swagger spec in that three operations are listed with responses. On deployment of generated spring server stub either on embedded container or anywhere list down all operations correctly but when i try out those operations it throw 415 status code in most of the cases.
Swagger-codegen version
swagger-codegen-2.2.2.jar
Swagger declaration file content or url
https://gist.github.com/AkhtarShahid/23fde58f6354436bc2a1eabd0b1b7899
Command line used for generation
uploaded yaml file given in link in swagger editor and generated spring application.
Imported the project in eclipse and run mvn clean install to generate jar file.
Used jar to run on embedded container.
Steps to reproduce
- Upload attached yaml file in swagger editor and generate spring application.
- run mvn clean install in root directory of downloaded project.
- run java -jar target/.jar to run application on embedded server.
- fire root url and append context path from application.properties to make UI up.
- Operation will be listed in UI.
- Try out any of these operations by passing an image file as jpeg or png.
- Response should be 200 but it is 415.
Related issues/PRs
Suggest a fix/enhancement
yaml content has below data in it
parameters:
- name: files
in: formData
type: file
if i change the files in field value of name to file then it works for one operation. Or if i change all interface generated in api package where file is being used as RequestBody to files then it works.
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 with the linked Swagger declaration and reproduce the generated Spring application using the stated mvn clean install and embedded-container steps. Inspect the generated interfaces in the api package where the uploaded file is used as a RequestBody, then verify the operations accept JPEG or PNG input and return 200 rather than 415.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100