Swagger 默认显示所有api, 如果要做路径过滤,可以这样做.

            //过滤,只显示部分api
            app.UseSwagger(c=> {
                c.PreSerializeFilters.Add((swaggerDoc, httpReq) => {
                    IDictionary<string, PathItem> paths = new Dictionary<string, PathItem>();
                    foreach (var path in swaggerDoc.Paths)
                    {
                        if(path.Key.StartsWith("/v1/api"))
                            paths.Add(path.Key, path.Value);
                    }
                    swaggerDoc.Paths = paths;
                });
            });

 https://stackoverflow.com/questions/45327119/how-to-set-base-path-property-in-swagger-for-net-core-web-api

 

相关文章:

  • 2021-05-07
  • 2021-07-23
  • 2021-04-28
  • 2021-10-06
  • 2022-12-23
  • 2021-08-27
  • 2021-10-13
  • 2021-10-18
猜你喜欢
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-06-10
  • 2021-05-19
  • 2021-08-17
  • 2022-12-23
相关资源
相似解决方案