swashbuckle - 如何删除此工件
问题描述
我正在使用 swashbuckle 来记录我的 API。当我打开招摇页面时,我会在图像中突出显示该项目。我如何摆脱它或更换它?使用 v5 的 swashbuckle 工具
解决方案
这里是部分。
Startup.cs - 服务
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v0", new OpenApiInfo
{
Version = "v0",
Title = "LTK Manager",
Description = "Sample Description",
TermsOfService = new Uri("https://example.com/terms"),
});
// Set the comments path for the Swagger JSON and UI.
var xmlFile = $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
c.IncludeXmlComments(xmlPath);
c.IgnoreObsoleteActions();
c.IgnoreObsoleteProperties();
});
Startup.cs - 配置
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("../swagger/v0/swagger.json", "LTK Manager V0 (alpha)");
c.DisplayOperationId();
});
路线装饰
/// <summary>
/// Retrieves a parameter store value from an account/region
/// </summary>
/// <remarks>Awesomeness!</remarks>
/// <response code="200">Returns an Object Containing the response from the API.</response>
[HttpPost]
[Route("getParamStoreValue")]
[ProducesResponseType(200)]
public IActionResult getKey([FromBody] ParamStoreRequest req)
推荐阅读
- c# - “Microsoft.Extensions.DependencyInjection”和每个环境的不同具体
- c# - 具有多个元素的 LINQ to XML
- java - 在 java 中获取 java.lang.ClassNotFoundException: java:comp/env/jdbc/oracleInstance?
- python - 将大小 > 1 的组替换为 pandas 数据框中的平均值
- jquery - FullCalendar 上仅显示第一个事件。我不知道为什么我不能显示多个事件
- c - 如何在 c 中使用 mkdir 创建文件夹?
- javascript - 将 Google 身份验证添加到 Firebase 实时数据库
- r - eval 中的错误(expr,envir,enclos):在 R 中找不到对象“Var1”
- express - 在多个文件中重构 express app.js
- excel - 使用 Excel 从 TFS 2013 迁移到 2017