swagger-api / swagger-api/swagger-ui

Only default x-example values used in curl call

Open
#5,745 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Q&A (please complete the following information)
  • OS: Win
  • Browser: Mozilla, Chrome
  • Version: Mozilla: 71.0, Chrome: 78.0
  • Method of installation: yarn
  • Swagger-UI version: swagger-ui/swagger-ui-react: ^3.24.3
  • Swagger/OpenAPI version: Swagger 2.0
Content & configuration

Example Swagger/OpenAPI definition:
Json swagger as several parameters with a x-example property set, which is used as the default values in the curl call, which is the main issue here

"parameters": {
    "requestId": {
      ...
      "x-example": "123ABC"
    },

Swagger-UI configuration options:

return <SwaggerUI spec={swaggerJson} />
Describe the bug you're encountering

When I try out our get paths with manually entered parameter values, it will still use the default "x-example"-values defined in the swagger doc.

To reproduce...

Steps to reproduce the behavior:

  1. Go to any get path
  2. Click on Try it out
  3. Scroll down to parameters, remove default values, fill in your own values
  4. Click Execute
  5. Curl will make the call, but will use the default x-example values for the query string parameters
Expected behavior

Expect the entered values to be the ones that curl will use as parameters

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 through the SwaggerUI spec configuration: open a GET path, use Try it out, replace or remove the x-example values, and execute the request. Trace the request-generation entry point used by curl and verify that the submitted parameter values, rather than the documented defaults, are used; done means the generated curl command and call contain the entered values.

Written by the indexing model from the issue text.

Assessment

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