0
嗨,我已经实现了使用JSON对象的Swagger UI,但问题是,“路径”(API调用)不是以字母数字顺序显示,而是我给了“apisSorter”作为alpha在JavaScript中。Swagger UI排序不适用于版本v2.1.4
当我使用调试工具时,JSON输出在Web控制台中正确显示,但在网页中显示时,按顺序显示了我在注释页面中提到的非字母数字方式。
下面是代码:
docExpansion: "none",
jsonEditor: false,
apisSorter: "alpha",
defaultModelRendering: 'schema',
showRequestHeaders: false
即使我试图从服务器端,但没有帮助排序JSON。
下面是代码:
usort($swg_result, function($a, $b) { //Sort the array using a user defined function
return $b->paths > $a->paths ? -1 : 1; //Compare the scores
});
任何帮助表示赞赏。