【问题标题】:Swagger 3.0 ASP.NET Core - How to add documentation for Model Schema in request Body and ResponseSwagger 3.0 ASP.NET Core - 如何在请求正文和响应中添加模型架构文档
【发布时间】:2019-11-02 19:41:43
【问题描述】:

我有 REST API 主体和响应的模型架构。 XML cmets 已定义,但我无法找到一种方法在 API bodyresponse 中包含 Swagger UI 3.0 中模型模式的 XML 文档? p>

【问题讨论】:

    标签: asp.net-core swagger swagger-ui openapi


    【解决方案1】:

    我错过了这个,它现在可以工作了。我让架构分布在不同的 asp.net 核心程序集上,而 Swagger UI 3.0 确实支持添加多个 XML 源。

    要包含控制器 cmets 本身,我们必须设置 includeControllerXmlComments: true

    c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "test1.xml"), includeControllerXmlComments: true);
    c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "test2.xml"), includeControllerXmlComments: true);
    c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "test3.xml"), includeControllerXmlComments: true);
    

    【讨论】:

      猜你喜欢
      • 2021-01-20
      • 2021-03-28
      • 2021-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多