swagger-ui
swagger-ui copied to clipboard
Deeplinking issue - Operation not expanded when added #/{tag}/{operationId}
Q&A (please complete the following information)
- OS: [windows]
- Browser: [chrome]
- Version: [120.0]
- Method of installation: [npm]
- Swagger-UI version: [e.g. 3.48.0]
Content & configuration
I am developing application in Angular 12. I am using swagger-ui npm package.
When I set deepLinking set to true and provided window.location.hash=#/{tag}/{operationId}
It is appending tag and operationId to the URL, but nothing is happening in swagger UI. it is not expanding the concerned operation.
When the swagger page loads, my url has a route with a number of query parameters. And when I am appending the fragment of tagid and operation id to it, it does not do deep linking functionality. It seems to work if only fragment is appended to domain, but does not work if url has a route and query params.
Swagger-UI configuration options:
SwaggerUI({
spec: JSON.parse(this.selectedApiDoc?.swaggerDoc),
domNode: this.swaggerDom.nativeElement,
layout: 'BaseLayout',
supportedSubmitMethods: [],
deepLinking: true,
onComplete: () => {
// Add a delay before calling scrollToSearchValue
window.location.hash = `#/${dataTag}/${this.routeId}`;
setTimeout(() => {
this.scrollToSearchValue(param);}, 1000);
}
});