Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Swagger UI have permalinks for paths?

Tags:

swagger-ui

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.

like image 867
Sujay Avatar asked Jul 17 '17 15:07

Sujay


People also ask

What is the difference between swagger and Swagger UI?

Swagger Editor: Swagger Editor lets you edit OpenAPI specifications in YAML inside your browser and to preview documentations in real time. Swagger UI: Swagger UI is a collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from an OAS-compliant API.

Can we customize Swagger UI?

By default, Swagger UI uses BaseLayout , which is built into the application. You can specify a different layout to be used by passing the layout's name as the layout parameter to Swagger UI. Be sure to provide your custom layout as a component to Swagger UI.

What is Swagger UI used for?

Swagger UI, a part of Swagger, is an open source tool that generates a web page that documents the APIs generated by the Swagger specification. This UI presentation of the APIs is user friendly and easy to understand, with all logic complexity kept behind the screen.


1 Answers

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,  // <------
like image 156
Helen Avatar answered Sep 22 '22 03:09

Helen