swagger-api / swagger-api/swagger-codegen

PetStore test server returns wrong data format for loginUser call

Open
#1,660 2 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 am preparing a PR related to cleaning up the Java Jersey client. In the process, I have rebuilt the PetStore Java client samples.

But while running the JUnit tests against the PetStore server(http://petstore.swagger.io/v2), I get an error on the UserApi.loginUser call.
The swagger API spec states that it should produce:

  • application/json
  • application/xml

In the response headers, application/json is specified, but I received:

logged in user session:...

This is not valid JSON, so my new code fails to deserialize it. However, I see in the old code (before my modifications) that there is a try catch and an exception for the String case.

Is it possible to do one of the following:

  • Modify the test server to send valid JSON
  • Change the spec and the response headers to indicate text/plain

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 with the PetStore Swagger API specification and the UserApi.loginUser call used by the Java Jersey client samples. Reproduce the JUnit failure against http://petstore.swagger.io/v2 and compare the declared response media types with the actual response body and headers. Done means the server response and specification agree on a valid format.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.