swagger-api / swagger-api/swagger-codegen
Cannot use the /docs to verify API
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
#9786 ### Description
I am starting to use the swagger-codegen. I build and try to run the PetStore nodejs server sample.
The server is started correctly at HTTP://localhost:8080/. Anyway when I try to verify APi, there are two issues:
- On HTTP://localhost:8080/docs, choose one API, eg, /pet/1/uploadImage, it actually cannot specify anything for body. Similar to other API, you cannot specify the body also.
- When the requestBody is "multipart/form-data", even though I try to use other API testing tool(Eg, postman) to specify the body of API /pet/1/uploadImage, only "additionalMetadata" get all body input, while "file" and "petId" is empty for the controller method. Should the controller only has one parameter for whole body?
Swagger-codegen version
I am using latest code of branch 3.0.0.
Swagger declaration file content or url
I did not make a line of code change for the testing.
Command line used for generation
Steps to reproduce
- git clone -b 3.0.0 https://github.com/swagger-api/swagger-codegen
- cd swagger-codegen/samples/server/petstore/nodejs
- npm install
- npm start
- HTTP://localhost:8080/docs
- go to /pet/{id}/uploadImage API and cannot find way to specify body parameters.
- use postman to specify body parameters for same API, but controller does not accept multi body parameters.
Related issues/PRs
Suggest a fix/enhancement
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
Reproduce the problem from samples/server/petstore/nodejs by running npm install and npm start, then open the generated /docs entry for /pet/{id}/uploadImage. Inspect the generated controller handling that operation and compare its multipart/form-data behavior with the request sent from Postman. Done means the docs expose the body inputs and the controller receives file, petId, and additionalMetadata correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100