swaggo / gin-swagger

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

Option to change the order/sorting of endpoints is not supported #288

Open PhlipTIP opened 8 months ago

PhlipTIP commented 8 months ago

The window.onload function for swaggerUI that contains the config does not support config for the operationsSorter value which handles the option to sort the endpoints either by method or alphabetically.

referencing the operationsSorter defined in the swagger.io docs


  // Build a system
  const ui = SwaggerUIBundle({
    url: "{{.URL}}",
    dom_id: '#swagger-ui',
    validatorUrl: null,
    oauth2RedirectUrl: {{.Oauth2RedirectURL}},
    persistAuthorization: {{.PersistAuthorization}},
   **//Proposed solution to add the operationsSorter when injecting config**
   operationsSorter: "method",
    presets: [
      SwaggerUIBundle.presets.apis,
      SwaggerUIStandalonePreset
    ],
    plugins: [
      SwaggerUIBundle.plugins.DownloadUrl
    ],
    layout: "StandaloneLayout",
    docExpansion: "{{.DocExpansion}}",
    deepLinking: {{.DeepLinking}},
    defaultModelsExpandDepth: {{.DefaultModelsExpandDepth}}
  })```