swagger-api / swagger-api/swagger-ui

JSON parameters passed via query string are interpreted as strings

Open
#3,302 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

is: breaking change P2 planning: for v4 type: bug version: 3.x
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Version:
3.0.17

Swagger file:
any file will reproduce this issue

Expected:
Passing "true" or "false" as query strings are parsed as booleans into boolean configuration fields.

Result:
"true" or "false" query strings are interpreted as strings, resulting in the following error (in dev):

warning.js:36 Warning: Failed prop type: Invalid prop `displayOperationId` of type `string` supplied to `Operation`, expected `boolean`.
    in Operation (created by Operations)
    in Operations (created by _class)
    in _class (created by Connect(_class))
    in Connect(_class) (created by BaseLayout)
    in section (created by Col)
    in Col (created by BaseLayout)
    in div (created by Row)
    in Row (created by BaseLayout)
    in div (created by BaseLayout)
    in div (created by BaseLayout)
    in BaseLayout (created by _class)
    in _class (created by Connect(_class))
    in Connect(_class)
    in section (created by Container)
    in Container
    in StandaloneLayout (created by _class)
    in _class (created by Connect(_class))
    in Connect(_class) (created by App)
    in App (created by _class)
    in _class (created by Connect(_class))
    in Connect(_class) (created by _class2)
    in Provider (created by _class2)
    in _class2

URL used to create error: http://localhost:3200/?displayOperationId=true

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 issue with the provided URL, ?displayOperationId=true, using Swagger UI 3.0.17, then trace how query-string configuration values are parsed and passed to the UI. Done means boolean query values such as true and false reach configuration fields as booleans rather than strings, without the reported prop-type warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
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.