-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Swagger UI path variables are broken on react 16+ #5165
Copy link
Copy link
Closed
Description
I'm running into an issue with swagger path parameters when serving through react versions greater than 16 (i'm not 100% sure exactly when it stopped working, but i have tested between versions 15.4.1 => 16.4.1 and I can get it working on the former.
I am using the very basic of set ups for my control test -- the petstore.json example (contained inside of the const spec)
and here is my App.js
class App extends Component {
componentDidMount() {
SwaggerUi({
dom_id: "#swagger-ui",
spec: spec,
presets: [presets.apis]
})
}
render() {
return (
<div className="App">
<h1>Swagger Test</h1>
<div>React version: {REACT_VERSION}</div>
<div>Swagger version: {SWAGGER_VERSION}</div>
<div id={"swagger-ui"} />
</div>
);
}
}
When trying to make a call through the UI which requires a path variable, the UI acts as if the field wasn't filled in:

However, that same API test works in React version 15.4.1. I am not sure what would be causing it and why it's related to the React versions.. but it is quite frustrating.
Any suggestions or workarounds?
Reactions are currently unavailable