swagger-api / swagger-api/swagger-codegen
Swagger-codegen generated method expects structured JSON response, while actual HTTP response from server is an XML document
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Hello!
I am using swagger-codegen-maven-plugin to generate a Java REST API client to use a REST API.
However, the swagger-codegen generated method expects structured JSON response, while the actual HTTP response from server is an XML document file containing an invoice.
The REST API has a method to get an invoice, as documented here:
https://swagger.maventa.com/#/invoices/getV1InvoicesId
The problem is that this API endpoint actually returns an XML file, which I want to download, and it doesn't return the JSON response as described in the swagger definition file.
So the auto-generated Java client code would look like this:

How can I make a HTTP GET request to /v1/invoices/{id} using the Java generated code, and make a call to invoicesApi.getV1InvoicesId(...) and get the returned XML document in return, even though the autogenerated client expects a object InvoicesHttpApiEntitiesInvoice in the response?
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 by comparing the Swagger definition for GET /v1/invoices/{id} with the actual XML response and the generated invoicesApi.getV1InvoicesId(...) method. No repository file or test is named; the issue is resolved when the expected response format and the generated Java client's handling of the invoice document are clearly aligned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100