swagger-api / swagger-api/swagger-codegen
C# swagger client code unable to handle XML response from JAXRS endpoint
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
I have a REST endpoint that can either produce XML or JSON output depending on a user’s preference. When I generate a Java client in swagger codegen the API will deserialize either a JSON or an XML representation into the model with no issues.
However, this is not the case for a C# codegen client. For some reason it’s always expecting a JSON format, is that by the design or am I missing something? Has anyone had the same issue? Any suggestion how to fix it?
Com.Test.Rs.Client.ApiException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
Thanks in advance.
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 reproducing the generated C# client against the JAXRS endpoint with an XML response, then compare its behavior with the Java client described in the issue. Inspect the C# code-generation templates and response deserialization path. Done means the generated C# client can deserialize the endpoint's XML representation as well as JSON.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100