swagger-api / swagger-api/swagger-ui
Clear button is not clearing the values in the form
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Bug description
I'm using swagger UI integrating with my service (dropwizard).
In some of the API's i'm exposing path parameters that showing as inputs or combo box in the UI.
After the user fill all the inputs he is performing execute request by clicking on the execute button. Afterward the clear button appear and when the client press it - it clear only the response and not the inputs values.
Example Swagger/OpenAPI definition:
schemes:
- https
paths:
"/start-unity":
post:
tags:
- start-unity
operationId: startUnity
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- in: query
name: flowName
default: parallel_unity_flow
type: string
- in: formData
name: firstName
type: string
- in: formData
name: lastName
type: string
- in: formData
name: country
type: string
Swagger-UI configuration options:
SwaggerUI({
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
spec: JSON.parse(jsonFile),
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
Steps to reproduce the behavior:
- Create swagger UI for any basic service with 1 API call having path params
- Click 'Try it out' button
- Fill value in the input box in the path param.
- Click execute button
- Click clear button
Expected behavior
The behavior i would expect is that the value i filled in the input in step 3 will discard.
Additional context:
I understand it now delete only the previous response but it is not make sense. If the behavior you want is to clear only the response so another clear button is needed to clear the fields in the relevant div in the form.
System
- OS: linux
- Browser: chrome
- Version: 70.0.3538.77
- Method of installation: dist assets
- Swagger-UI version: 3
- Swagger/OpenAPI version: Swagger 2.0
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 issue with the SwaggerUIBundle configuration and the Swagger 2.0 example, following the Try it out, execute, and clear flow for path or form parameters. Trace the clear-button behavior and verify that clearing removes both the previous response and the entered input values without affecting the operation definition.
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
- 45/100