swaggo / gin-swagger

gin middleware to automatically generate RESTful API documentation with Swagger 2.0.
MIT License
3.76k stars 270 forks source link

definition #188

Open Optimus922 opened 2 years ago

Optimus922 commented 2 years ago

image Can we do this as in the above red rec?

This is from Swashbuckle.AspNetCore. I wonder if we can do this in swaggo.

It's a combobox, when one item selected, only certain grouped apis are loaded.

ubogdan commented 2 years ago

I don't see a real reason to have this added into gin-swagger.

Multiple definitions configuration option is supported in Swagger UI 3.0.18 and later. See the following example:

window.onload = function() {
  // Build a system
  const ui = SwaggerUIBundle({
    urls: [
      {url: "https://path/to/api1.yaml", name: "API One"},
      {url: "https://path/to/api2.yaml", name: "API Two"},
    ],
    "urls.primaryName": "API Two"  // default document (if other than the first)
    ...
  })
Optimus922 commented 2 years ago

Well, if too many apis in one page, let's say a thousand, the web page can be very laggy when it's being loaded or refreshed.

Multiple definitions can solve this problem. It only loads certain apis within a certain definition. You divide the one thousand apis into 100 definitions, each time only 10 apis are loaded.

So I wonder if it's possible to migrate this feature into swaggo...