| | |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Autofac; |
| | |
| | | //å为2份æ¥å£ææ¡£ |
| | | c.SwaggerDoc("v1", new OpenApiInfo { Title = "WIDESEA_Coreåå°Api", Version = "v1", Description = "è¿æ¯å¯¹ææ¡£çæè¿°ãã" }); |
| | | c.SwaggerDoc("v2", new OpenApiInfo { Title = "WIDESEA_Core对å¤ä¸æ¹Api", Version = "v2", Description = "xxxæ¥å£ææ¡£" }); //æ§å¶å¨é使ç¨[ApiExplorerSettings(GroupName = "v2")] |
| | | //å¯ç¨ä¸ææ³¨éåè½ |
| | | // var basePath = PlatformServices.Default.Application.ApplicationBasePath; |
| | | // var xmlPath = Path.Combine(basePath, "WIDESEA_WebApi.xml"); |
| | | // c.IncludeXmlComments(xmlPath, true);//æ¾ç¤ºæ§å¶å¨xml注éå
容 |
| | | //æ·»å è¿æ»¤å¨ å¯èªå®ä¹æ·»å 对æ§å¶å¨ç注éæè¿° |
| | | //c.DocumentFilter<SwaggerDocTag>(); |
| | | //å¯ç¨ä¸ææ³¨éåè½ |
| | | // var basePath = PlatformServices.Default.Application.ApplicationBasePath; |
| | | // var xmlPath = Path.Combine(basePath, "WIDESEA_WebApi.xml"); |
| | | // c.IncludeXmlComments(xmlPath, true);//æ¾ç¤ºæ§å¶å¨xml注éå
容 |
| | | //æ·»å è¿æ»¤å¨ å¯èªå®ä¹æ·»å 对æ§å¶å¨ç注éæè¿° |
| | | //c.DocumentFilter<SwaggerDocTag>(); |
| | | |
| | | var security = new Dictionary<string, IEnumerable<string>> { { AppSetting.Secret.Issuer, new string[] { } } }; |
| | | c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme() |
| | |
| | | BearerFormat = "JWT", |
| | | Scheme = "Bearer" |
| | | }); |
| | | |
| | | #region å¯ç¨ä¸ææ³¨éåè½ |
| | | //WIDESEA_WebApiä¸çPropertyGroupæ·»å <GenerateDocumentationFile>true</GenerateDocumentationFile><!--å¯ç¨ä¸ææ³¨éåè½--> |
| | | //å¯ç¨ä¸ææ³¨éåè½ |
| | | var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; |
| | | //IncludeXmlComments true æ¾ç¤ºæ§å¶å¨æ³¨é |
| | | c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename), true); |
| | | #endregion |
| | | c.AddSecurityRequirement(new OpenApiSecurityRequirement |
| | | { |
| | | { |