swagger-api / swagger-api/swagger-codegen

C# swagger client code unable to handle XML response from JAXRS endpoint

Open
#4,900 3 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.