1. Add NuGet packages to your project Abp.Web.Api.SwaggerTool
2. Add Abpwebapiswaggertoolmodule to the DependsOn of the project ABP module
Run it, launch the project, Access/swagger/ui/index to open the familiar Swagger-ui interface, and the interfaces for Webapi and dynamic APIs appear in the project.
Abp.Web.Api.SwaggerTool, as a swagger enhancement package, implements many useful features internally and provides some best practices that users don't care about swagger integration issues.
Project source code Https://github.com/yuzukwok/Abp.Web.Api.SwaggerTool We can put forward issue or fork
V0.1.1
function Introduction
1. Remote Agent Generation
We can generate remote agents that access these APIs based on the API meta-information described in the swagger documentation, currently supporting CSharp Webapiclient,jquery or Angularjs code.
The user accesses the following endpoint to obtain the code for the agent
/swagger/proxy/csharp
/swagger/proxy/jquerycallbacks
/swagger/proxy/jquerypromises
/swagger/proxy/angularjs
/swagger/proxy/angular2
2. Convert swagger document to postman supported import format, which is more versatile than Postman's own import function
Access point:/swagger/postman
Categorized by folder, supports Chinese annotations, and the Post interface automatically generates sample data
3. Can search the interface directly on the SWAGGER-UI, currently only support search API address
/swagger/docs/{apiversion}/{key to search by path}
4.6 Kinds of swagger-ui style, get rid of the default Swagger-ui
Https://github.com/ostranme/swagger-ui-themes
5. Enhanced Swashbuckle: Optimize enumeration display, automatically use the Display feature text, Webapicontroller class on the DisplayName feature can display the controller's comments on Swagger-ui
Configuration file Description
The class library uses LTS. Configuation as a profile convention, no configuration file is required by default
In the site root configuration. config folder, create a new Swaggertoolsettings.json file with the following file contents
{ "Enable":true,//whether to enable swagger integration"Theme": "Flattop",//Topic name Flattop,muted,newspaper,outline,monokai,feeling-blue"Csharpgen": { "ClassName": "Apiclient",//class name generated by C # proxy"Namespace": "Apiservices"//C # Proxy-generated namespaces }, "Typescriptgen": { "ClassName": "Client",//the class name generated by the JS proxy"Namespace": "Apiservices"//the namespace generated by the JS proxy }, "Postmangen": { "Name": "Apiservices"//name }, "Xmlcommentfiles": ["Xxx.xml"]//the file name of the XML comment}
Best practices for ABP integrated swagger