Merge pull request #119 from STRML/sortEndpointsAgain

Sort APIs and operations.
This commit is contained in:
Miroslav Bajtoš 2015-09-08 18:19:36 +02:00
commit 7959ad38aa
1 changed files with 8 additions and 1 deletions

View File

@ -16,6 +16,7 @@ $(function() {
var accessToken; var accessToken;
function loadSwaggerUi(config) { function loadSwaggerUi(config) {
var methodOrder = ['get', 'head', 'options', 'put', 'post', 'delete'];
window.swaggerUi = new SwaggerUi({ window.swaggerUi = new SwaggerUi({
url: config.url || '/swagger/resources', url: config.url || '/swagger/resources',
apiKey: '', apiKey: '',
@ -48,7 +49,13 @@ $(function() {
}, },
docExpansion: 'none', docExpansion: 'none',
highlightSizeThreshold: 16384, highlightSizeThreshold: 16384,
sorter: 'alpha' apisSorter: 'alpha',
operationsSorter: function(a, b) {
var pathCompare = a.path.localeCompare(b.path);
return pathCompare !== 0 ?
pathCompare :
methodOrder.indexOf(a.method) - methodOrder.indexOf(b.method);
}
}); });
$('#explore').click(setAccessToken); $('#explore').click(setAccessToken);