3

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

1

1 Answer 1

0

The missing was to trigger event for React. This answer worked charmly! https://stackoverflow.com/a/46012210/5209556

Sign up to request clarification or add additional context in comments.

1 Comment

Finally! After two hours of debugging, your answer worked for me. Thank you! As @Grin said at the link, the problem is: Setter .value= is not working as we wanted because React library overrides the input value setter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.