swagger-api / swagger-api/swagger-ui

Invalid POST JSON body fails silently

Open
#5,828 5 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Hacktoberfest type: bug
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: Ubuntu 18
  • Browser: chrome
  • Version: 80.0.3987.87 (Official Build) (64-bit)
  • Method of installation: npm
  • Swagger-UI version: 3.25.0
  • Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]
Describe the bug you're encountering

An invalid JSON body doesn't display an error message or state. If you enter invalid JSON and click execute, nothing seems to happen. This can be reproduced on this endpoint that accepts JSON.

To reproduce...

Steps to reproduce the behavior:

  1. Go to https://petstore.swagger.io/#/pet/addPet
  2. Click on try it out
  3. change the body to any invalid JSON string
  4. Attempt to execute the request
Expected behavior

An error message or some state change that makes it clear that the input is invalid.

Screenshots

Screenshot from 2020-02-07 14-48-06

Additional context or thoughts

I wasn't able to track down any open issues for this, but I did find an old one that may be related: https://github.com/swagger-api/swagger-ui/issues/5648

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 at https://petstore.swagger.io/#/pet/addPet using Try it out and an invalid JSON body. Trace the request execution and validation feedback from that interaction, then verify that an invalid body produces an error message or another visible state change instead of appearing to do nothing.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.