Sujay
Sujay

Reputation: 95

Does Swagger UI have permalinks for paths?

Is it possible to link to a specific path displayed in Swagger UI, such as to /work/2.1 on the image below?

This is my swagger ui relative path

I want to link to individual paths from an external web page.

Upvotes: 8

Views: 5666

Answers (2)

Maxim
Maxim

Reputation: 1

Added Deep Link support to SwaggerUI:

app.UseSwaggerUI(c =>
{
    ...
    c.EnableDeepLinking();
});

Upvotes: 0

Helen
Helen

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

Related Questions