API methods Sorting : Swagger version 3.0.2

徘徊边缘 提交于 2019-12-12 10:59:12

问题


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.


回答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.



来源:https://stackoverflow.com/questions/42977003/api-methods-sorting-swagger-version-3-0-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!