зеркало из https://github.com/Azure/autorest.az.git
sort requried params (#482)
This commit is contained in:
Родитель
a7fd9bb1cd
Коммит
7a5ee36264
|
@ -106,6 +106,13 @@ export class CodeModelCliImpl implements CodeModelAz {
|
|||
}
|
||||
return order;
|
||||
}
|
||||
function requiredParamLength(parameters) {
|
||||
let ret = 0;
|
||||
for(var i = 0; i < parameters.length; ++i){
|
||||
if (parameters[i].required) ret++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
let oa = getOrder(a.language['az']['name']);
|
||||
let ob = getOrder(b.language['az']['name']);
|
||||
if(oa < ob) {
|
||||
|
@ -118,6 +125,9 @@ export class CodeModelCliImpl implements CodeModelAz {
|
|||
if(la != lb) {
|
||||
return la.localeCompare(lb);
|
||||
}
|
||||
let requiredLenA = requiredParamLength(a.parameters);
|
||||
let requiredLenB = requiredParamLength(b.parameters);
|
||||
if (requiredLenA!=requiredLenB) return requiredLenA > requiredLenB? -1: 1;
|
||||
return a.parameters.length > b.parameters.length? -1: 1;
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче