swagger-api / swagger-api/swagger-codegen
Codegen doesn't use "example" for response body
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Not sure if this is by design or bug.
I have example for every object under definitions section. When I use codegen to generate a nodejs server, I am hoping at least the response body for GET should use the example data, but it doesn't.
Example data shows up under "Response Class", but when I click "Try it out!", in stead of example data, I get generic json object generated by Codegen using the schema. Like {"userName": "aeiou"}
Do I miss anything? Thanks
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 this with an API definition containing examples under definitions, then read the Node.js server codegen path and the response-body handling used by “Try it out!”. Compare the generated response with the example shown in “Response Class”; done means the intended example behavior is established and the generated response or documented behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, openapi
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100