OpenAPI 3.x: request body doesn't update when changing between content type in try it out
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:
- Go to https://petstore3.swagger.io/
- Click on
/petPUT request - Click on try it out button
- Edit the value
- Switch to
application/xmlcontent type - 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:
When switching from application/xml to application/json:
Investigating a different issue, I found this https://github.com/swagger-api/swagger-ui/blob/f91ca8237eec4bf92fc6da9e1697810c8f25f1cc/src/core/components/parameters/parameters.jsx#L79-L93 It seems like right now this is an expected behaviour so that we don't override the user's changes if they edited any values. If the user wants the default value for the content type they switched to, they have to click on the reset button.
Is this something that we would like to change or is this behaviour fine?