swagger-api / swagger-api/swagger-ui
Frontend validation error popup text is in a hard to read format
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)
- Browser: Chrome
- Using the Swagger Petstore or Petstore 2.0 online demo - https://petstore.swagger.io/#/pet/addPet & https://editor.swagger.io/
Describe the bug you're encountering
Swagger-ui's frontend validation for json values (e.g. for put or post) seems to render the parameter text in the error message popup in a hard to read format. Instead of using the parameter name e.g. photoUrls, it uses the following syntax: propKey+parameter+error. The html is rendered as
<div class="validation-errors errors-wrapper">Please correct the following validation errors and try again.
<ul>
<li>
::marker
"propKey"
"parameter" (+possibly more than one)
"error"
</li>
</ul>
</div>
which makes the content in the li tag look pretty unreadable in the error popup since each string is rendered without spaces in-between.
To reproduce...
Steps to reproduce the behavior:
- Go to https://petstore.swagger.io/#/pet/addPet or https://editor.swagger.io/
- Click on PUT or POST /pet
- Edit a parameter like photoUrls which requires a string and instead enter a number
- Press execute
- See validation error popup with hard to read error message
Expected behavior
The strings inside of the li tag would be much easier to read if there were spaces in between the words 😄
It would also be beneficial to just see the name of the parameter without "propKey" or "error", possibly also with a seperator between the parameter and the error message (e.g. photoUrls: Value must be a string // or in this case photoUrls[0]: Value must be a string).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the validation popup using the Petstore demo: open PUT or POST /pet, enter a number for the photoUrls string parameter, and execute it. Inspect the frontend validation error rendering and make the list item readable, showing the parameter name and separating it from the error; done means the popup displays clear text instead of concatenated propKey, parameter, and error strings.
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
- Clearly specified
- Newbie friendliness
- 35/100