OpenAPITools / OpenAPITools/openapi-generator
[java-client] String response body sent as 'application/json'
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
While I was working on a test suite for the java clients (I will post my results in #689)
I have noticed that if the server sends a response with Content-Type application/json and following body:
"Hello world"
It gets wrongly de-serialized by the JaxRS based java clients:
expected:<"[Hello world]"> but was:<"\"Hello world\"">
The default java-client (using okhttp and gson) do not have the issue.
Only a quoted string as JSON value used to be illegal (you find a lot of posts telling this), but the newest JSON RFC 7159 says that this is now valid.
The reference website JSONLint also tells that "Hello world" is a valid JSON value.
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 examining the JAX-RS-based Java client response deserialization path and compare it with the default OkHttp/Gson client behavior. Reproduce the case with Content-Type application/json and the quoted JSON value "Hello world"; done means the JAX-RS clients deserialize that valid response without the extra quoting shown in the report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100