Reputation: 323
I'm using SwaggerUI 3.21.0 and would like to set a query parameter value programmatically. When you press the button, the calculated value is set as the parameter. The parameter itself is defined in the openapi.yaml and a textbox is created by SwaggerUI. First I tried $(element).val(value)
with jQuery, and the value appeared in the textbox, however it didn't affect the url SwaggerUI requests. Next I noticed that SwaggerUI uses React under the hood, and tried FindReact
and setState
from the question below. However, this also didn't affect the url. It seems like that SwaggerUI keeps the values somewhere internally. Does anyone have any idea?
React - getting a component from a DOM element for debugging
Upvotes: 3
Views: 1084
Reputation: 323
The missing was to trigger event for React. This answer worked charmly! https://stackoverflow.com/a/46012210/5209556
Upvotes: 0