【发布时间】:2023-01-24 14:23:50
【问题描述】:
I have a list of APIs and when one of the APIs is selected, I want to display the Swagger page for that API only.
在 Program.cs 文件中
if (app.Environment.IsDevelopment())
{
app.UseSwagger(options =>
{
});
app.UseSwaggerUI(options =>
{
});
}
【问题讨论】:
-
所以您只想更改 Swagger 文档页面的外观/交互性?因为你的问题的标题表明你想构建一个 Swagger服务定义在运行时,这不是你所描述的。
-
Program.cs 中提到的代码将在启动时执行一次,而不是在运行时执行。
标签: c# swagger-ui