3

I am using swagger version 3.0.2 , I have also followed this answer but there was no effect on the method order.

window.onload = function() {

  const ui = SwaggerUIBundle({
  .....
  apisSorter: "alpha",
  layout: "StandaloneLayout"
})

Can any one tell the best way to change the order of the API methods.

Community
  • 1
  • 1
Syed Uzair Uddin
  • 3,296
  • 7
  • 31
  • 47

1 Answers1

1

Swagger UI 3.0.7 added support for 2.x's operationsSorter parameter that controls method sorting inside each API/tag.

operationsSorter

Apply a sort to the operation list of each API. It can be 'alpha' (sort by paths alphanumerically), 'method' (sort by HTTP method) or a function (see Array.prototype.sort() to know how sort function works). Default is the order returned by the server unchanged.

const ui = SwaggerUIBundle({
  url: "http://petstore.swagger.io/v2/swagger.json",
  ...
  operationsSorter: "alpha"
})

The apisSorter parameter is not yet supported in 3.x.

Community
  • 1
  • 1
Helen
  • 87,344
  • 17
  • 243
  • 314