Base solution for your next web application
Open Closed

The best practice of Abp integrated Swagger #1478


User avatar
0
yuzukwok created

1 add the nuget package Abp.Web.Api.SwaggerTool 2 add AbpWebApiSwaggerToolModule DependsOn to the Abp module in the project

And then we can start project to visit /swagger/ui/index, the project webapi and dynamic Api interface have appeared.

Abp.Web.Api.SwaggerTool as a swagger enhancement package, the internal implementation of a lot of useful functions and provides some of the best practices, users do not need to care about the integration of Swagger. Project source <a class="postlink" href="https://github.com/yuzukwok/Abp.Web.Api.SwaggerTool,you">https://github.com/yuzukwok/Abp.Web.Api.SwaggerTool,you</a> can put issue or fork under

Function introduction 1 remote agent generation We can according to the swagger document describes the Api meta information generated to access the remote agent of these Csharp, currently supports WebApiClient Api, Jquery or AngularJS code, etc.. User access to the following endpoint code to obtain the agent /swagger/proxy/CSharp /swagger/proxy/JQueryCallbacks /swagger/proxy/JQueryPromises /swagger/proxy/AngularJS /swagger/proxy/Angular2

2 conversion of swagger documents to the format what can import into POSTMAN.It better than the POSTMAN fu Access point: /swagger/postman POST interface can automatically generated sample data 3 It can be directly on the swagger-ui search interface, currently only supports Search API address To search by path to visite /swagger/docs/{apiVersion}/{keytosearch} 4.six kinds of swagger-ui style, get rid of the default swagger-ui <a class="postlink" href="Https://github.com/ostranme/swagger-ui-themes">Https://github.com/ostranme/swagger-ui-themes</a>

5 to strengthen the Swashbuckle: the optimization enumeration display, the automatic use of Display characteristics of the text, WebApiController class plus DisplayName characteristics can be displayed on the Controller swagger-ui notes Configuration file description

Class library using lts.Configuation as the configuration file, the default configuration file does not need . If you need to config the Moudle,you can put SwaggerToolSettings.json into folder named .config in the root directory of the site.

{ "enable": true, "theme": "flattop", // flattop,muted,newspaper,outline,monokai,feeling-blue "CSharpGen": { "ClassName": "ApiClient", "Namespace": "ApiServices" }, "TypeScriptGen": { "ClassName": "Client", "Namespace": "ApiServices" }, "PostmanGen": { "name": "ApiServices" }, "XmlCommentFiles": ["xxx.xml"]

}


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Thank you very much for your work. I'll investigate it deeply in a short time and provide feedback.