Sort the API Definition

pull/18327/head
liangshiwei 2 years ago
parent 6da0b12fbd
commit efa5b2ac85

@ -21,6 +21,7 @@ using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Modeling; using Volo.Abp.Http.Modeling;
using Volo.Abp.Reflection; using Volo.Abp.Reflection;
using Volo.Abp.Threading; using Volo.Abp.Threading;
using System.Collections.Concurrent;
namespace Volo.Abp.AspNetCore.Mvc; namespace Volo.Abp.AspNetCore.Mvc;
@ -79,6 +80,7 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide
} }
} }
model.NormalizeOrder();
return model; return model;
} }

@ -22,7 +22,7 @@ public class ApplicationApiDescriptionModel
return new ApplicationApiDescriptionModel return new ApplicationApiDescriptionModel
{ {
Modules = new ConcurrentDictionary<string, ModuleApiDescriptionModel>(), //TODO: Why ConcurrentDictionary? Modules = new ConcurrentDictionary<string, ModuleApiDescriptionModel>(), //TODO: Why ConcurrentDictionary?
Types = new Dictionary<string, TypeApiDescriptionModel>() Types = new SortedDictionary<string, TypeApiDescriptionModel>()
}; };
} }
@ -55,4 +55,9 @@ public class ApplicationApiDescriptionModel
return subModel; return subModel;
} }
public void NormalizeOrder()
{
Modules = Modules.OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value);
}
} }

@ -35,7 +35,7 @@ public class ModuleApiDescriptionModel
{ {
RootPath = rootPath, RootPath = rootPath,
RemoteServiceName = remoteServiceName, RemoteServiceName = remoteServiceName,
Controllers = new Dictionary<string, ControllerApiDescriptionModel>() Controllers = new SortedDictionary<string, ControllerApiDescriptionModel>()
}; };
} }

Loading…
Cancel
Save