-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Description
- Browser: [chrome]
- Version: [5.31.0]
- Method of installation: [npm install swagger-ui-react]
- Swagger-UI version: [5.31.0]
- Swagger/OpenAPI version: [OpenAPI 3.2]
Swagger-UI configuration options:
const { spec } = useApiDoc(specId);
<SwaggerUI
spec={spec}
persistAuthorization={false}
withCredentials
tryItOutEnabled={false}
supportedSubmitMethods={[]}
/>Hello,
I am building React app that allows to search for API docs. Those API docs are returned by external endpoint as JSON.
I have observed an issue, when feeding specs to SwaggerUI component, some parts of it are out of sync. For example when I select api doc X, and then api doc Y and schema definitions are not updating, still displaying content of api doc X. The rest of the content seems OK (endpoint definitions and api description). Tried to use pure JavaScript version of Swagger UI package (no React) but the effect remains the same. I have also tried to manually remove Swagger component from DOM and re-mount it with new data, but it didn't help either. I have noticed that SwaggerUI uses Redux & ImmutableJS, but I didn't find any hooks that would allow to interact with internal SwaggerUI state.
So my questions it:
How do I handle dynamic api docs in Swagger UI ? Is Swagger UI designed to handle dynamic data ?
I have search all issues on GitHub and docs, but didn't find similar issue.
Thanks.