swagger-api / swagger-api/swagger-codegen
[PHP] Incorrect return types if multiple responses are defined
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
If you define multiple responses, the codegen will only support the first one (typically 200).
Swagger-codegen version
2.3
Swagger declaration file content or url
/path
post:
responses:
200:
schema:
$ref: '#/definitions/EmptyResponse'
202:
schema:
$ref: '#/definitions/InBackgroundResponse'
Suggest a fix/enhancement
Correctly generate the return-object based on the HTTP Status Code in the Response.
Also fix ReturnType info in DocBlock
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
No file or test is named in the issue. Start by tracing PHP code generation for an operation with multiple responses, then inspect how response status codes determine return types and DocBlock metadata. Done means generated PHP code selects the appropriate response model for each HTTP status code and documents the resulting return type correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100