swagger-api / swagger-api/swagger-ui

OpenAPI 3.x: request body doesn't update when changing between content type in try it out

Open
#9,699 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: try-it-out specification: 3.x type: bug
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Describe the bug you're encountering

Request body value in try it out isn't being updated when switching to a different content type, if the value was edited.

To reproduce...

Steps to reproduce the behavior:

  1. Go to https://petstore3.swagger.io/
  2. Click on /pet PUT request
  3. Click on try it out button
  4. Edit the value
  5. Switch to application/xml content type
  6. See that the value didn't update

The same thing will happen if we edit application/xml first and then switch to application/json.

Expected behavior

The value should switch to the default value for the current content type.

Screenshots

When switching from application/json to application/xml:

Screenshot 2024-03-14 at 14 53 20

When switching from application/xml to application/json:

Screenshot 2024-03-14 at 14 54 32

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 in the Swagger Petstore at the /pet PUT operation: enter Try It Out, edit the request body, and switch between application/json and application/xml. Trace the request-body handling for content-type changes; done means each switch displays the default value for the selected content type, in both directions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.