swagger-api / swagger-api/swagger-codegen
Go generation does not exhaustively sense every kind of response JSON content-type
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
The generation of the Go language APIClient's decode() method looks for application/json to recognise JSON content-type.
This doesn't represent all real-life scenarios, for example application/vnd.oracle.resource+json is a JSON payload.
Swagger-codegen version
3.0.35
Swagger declaration file content or url
...
"responses": {
"200": {
"description": "Retrived record.",
"headers": {...},
"content": {
"application/vnd.oracle.resource+json; type=singular": {
"schema": {
"$ref": "#/components/schemas/invoice"
}
}
}
},
...
-->
Command line used for generation
swagger-codegen generate -i ./input.json -o ./generated -l go
Steps to reproduce
Just run the command line above.
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
Start with the Go APIClient decode() method generated by swagger-codegen generate -i ./input.json -o ./generated -l go, using the response content type shown in the issue to reproduce the behavior. Done means the generated client recognizes that JSON response content type during decoding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100