Swagger接口文档描述显示注释内容

一、Swagger接口文档描述显示注释内容

 

 

 ①右击项目属性=>生成=>输出

 

 

 ②Swagger配置

services.AddSwaggerGen(config =>
            {
                #region 配置API文档说明
                config.SwaggerDoc("v1", new OpenApiInfo
                {
                    Version = "v1",
                    Title = "FirstPropertiesBackendAPI",
                    Description = "接口文档",
                    Contact = new OpenApiContact
                    {
                        Name = "Name",
                        Email = "test"
                    }
                });

                var basePath = AppContext.BaseDirectory;
                var xmlPath = Path.Combine(basePath, "FirstPropertiesBackendAPI.xml");
                config.IncludeXmlComments(xmlPath, true);
                #endregion
            });

 

                app.UseSwagger();
                app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "FirstPropertiesBackendAPI v1"));

 

posted @ 2023-03-21 16:25  点终将连成线  阅读(907)  评论(0编辑  收藏  举报