gpt4 book ai didi

swagger - API 方法排序 : Swagger version 3. 0.2

转载 作者:行者123 更新时间:2023-12-04 21:34:08 29 4
gpt4 key购买 nike

我正在使用 swagger version 3.0.2 ,我也关注了this answer但对方法顺序没有影响。

window.onload = function() {

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

谁能说出更改 API 方法顺序的最佳方法。

最佳答案

Swagger UI 3.0.7 添加了对 2.x 的 operationsSorter 参数的支持,该参数控制每个 API/标记内的方法排序。

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"
})

3.x 尚不支持 apisSorter 参数。

关于swagger - API 方法排序 : Swagger version 3. 0.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42977003/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com