swagger-api / swagger-api/swagger-ui

Simple JSON String cause can't parse JSON. Raw result:

Open
#7,920 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: support
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Having a simple REST GET request runnig in Swagger-UI cause this issue.
The server returns the simple JSON String "Hello World".
The issue is reproducable in Firefox, Edge and Chrome.

  • Swagger UI version: 3.20.9
  • swagger-core version: 2.0.7

openApiDefinition:

{
  "openapi" : "3.0.1",
  "info" : {
    "title" : "Simple Rest",
    "description" : "",
    "version" : "1.0"
  },
  "servers" : [ {
    "url" : ""
  } ],
  "paths" : {
      "/helloWorld" : {
      "get" : {
        "tags" : [ "Miscellaneous" ],
        "summary" : "Test helloWorld",
        "description" : "helloWorld ",
        "operationId" : "helloWorld",
        "responses" : {
          "200" : {
            "description" : "helloWorld on success",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "string"
                }
              }
            }
          }
        }
      }
    }
  }
}

grafik

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

Reproduce the /helloWorld GET request in Swagger UI 3.20.9 using the supplied OpenAPI definition and a response containing the JSON string "Hello World". Trace the response parsing from the Swagger UI request entry point, then verify that the response renders without a JSON parse error in Firefox, Edge, and Chrome.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
api, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.