Reputation: 95
Is it possible to link to a specific path displayed in Swagger UI, such as to /work/2.1
on the image below?
I want to link to individual paths from an external web page.
Upvotes: 8
Views: 5666
Reputation: 1
Added Deep Link support to SwaggerUI:
app.UseSwaggerUI(c =>
{
...
c.EnableDeepLinking();
});
Upvotes: 0
Reputation: 97991
Yes, Swagger UI has permalinks for operations and tags. To get a permalink, expand an operation or tag and copy the URL in the address bar. Permalinks look like this:
index.html#/tagName
index.html#/tagName/operationId
When someone opens such a permalink in a browser, the corresponding tag or operation is automatically expanded and also scrolled to the top if needed. Example:
https://petstore.swagger.io/#/store/getInventory
In Swagger UI 2.2 permalinks are enabled by default.
If you use UI 3.x, you need version 3.0.19 or later, and you need to add deepLinking: true
to the Swagger UI init code in your index.html
:
const ui = SwaggerUIBundle({
url: "http://petstore.swagger.io/v2/swagger.json",
deepLinking: true, // <------
Upvotes: 11