问题描述
https://github.com/domaindrivendev/Swashbuckle.AspNetCore
默认情况下,Swagger JSON将在以下路径中公开- “ /swagger/{documentName}/swagger.json”。如有必要,可以更改 启用Swagger中间件时可以使用此功能。自定义路线必须包括 {documentName}参数。
为什么模板配置需要此占位符,而UI配置却不需要?
app.UseSwagger(c =>
{
c.RouteTemplate = "api-docs/{documentName}/swagger.json";
})
NOTE: If you're using the SwaggerUI middleware,you'll also need to update its configuration to reflect the new endpoints:
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/api-docs/v1/swagger.json","My API V1");
})
{documentName}
的作用是什么?是否有功能可以动态交换出来?因为示例中的UI配置具有静态配置。为什么在RouteTemplate配置中也不会只是"/api-docs/v1/swagger.json"
?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)