- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
还没想好,this不一样。
我认为这应该是不言自明的。我想在 Swagger 文档中包含类描述。我的 Swagger
配置如下所示:
config.EnableSwagger(c =>
{
c.SingleApiVersion("v1", "My Api Name");
c.OperationFilter<AddAuthorizationHeaderParameterOperationFilter>();
c.IncludeXmlComments(GetXmlCommentsPath());
}).EnableSwaggerUi(c => { });
MyAwesomeController
看起来像这样:
/// <summary>
/// Controller description (is included by Swashbuckle)
/// </summary>
public class MyAwesomeController : ApiController
{
/// <summary>
/// Method description (is included by Swashbuckle)
/// </summary>
public IHttpActionResult Get()
{
return Ok("hello... from the other side");
}
public IHttpActionResult Post([FromBody]MyAwesomeModel model)
{
return Ok("hello... from the other side");
}
}
MyAwesomeModel
看起来像这样:
/// <summary>
/// **I would like this to be included in the Swagger description of the parameter**
/// </summary>
public class MyAwesomeModel
{
/// <summary>
/// **I would like this to be included in the Swagger description of the parameter**
/// </summary>
public string MyProperty { get; set; }
}
最佳答案
嗯......所以也许如果其他人遇到这个。
基本上我找到了一种可以做到这一点的方法,我意识到为什么默认情况下没有这样做。不确定这是否是最好的方法,但它就在这里。
在我的解决方案中,POCO 位于与实际 API 分开的项目中,因此,注释描述为 MyAwesomeModel
未包括在内,因为没有为类和属性生成 XML 节点。因此,在 POCO 所在的单独项目中,我修改了属性以生成 XML。
Swashbuckle
寻找它。我用过 Post-build event command line
在项目属性中; copy "$(SolutionDir)MyAwesomeProjectWithPocos\bin\MyAwesomeProjectWithPocos.xml" "$(ProjectDir)\bin\MyAwesomeProjectWithPocos.xml"
SwaggerConfig
也包含此 XML config.EnableSwagger(c =>
{
c.SingleApiVersion("v1", "My Api Name");
c.OperationFilter<AddAuthorizationHeaderParameterOperationFilter>();
c.IncludeXmlComments(GetXmlCommentsPath());
c.IncludeXmlComments(GetXmlCommentsPathForModels());
}).EnableSwaggerUi(c => { });
Model Schema
切换至
Model
我现在可以阅读整个模型和属性描述。
GetXmlCommentsPathForModels());
中指向正确的位置即可。但这是我的选择。
关于asp.net-web-api - 如何在 Swashbuckle 中包含类和属性描述,使用 OWIN 为 Web Api 2 生成 Swagger 文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39576189/
我正在构建一个 MVC 5 应用程序。我需要根据 AD 和 sql 数据库或 Web 服务对人员进行身份验证。 要求是如果一个人登录到公司网络或通过 VPN 连接,我必须在不要求凭据的情况下登录它们。
有没有办法从 WindowsAzureActiveDirectoryBearerAuthenticationOptions 等扩展中调试 OWIN 中间件,并确切了解请求被拒绝的原因(例如,没有 to
我们对 Nancy/Owin 托管的 api 有一种奇怪的体验 - 当 URL 查询字符串超过 255 个字符时,Nancy 返回 400 Bad Request。 知道如何解决这个问题吗? 最佳答案
正确的处理方式是什么Content-Length在 Owin 中间件中编写正文内容时? 目前我们正在使用 context.Response.Write(data); // data is a stri
我目前正在构建一个包含多个 OWIN 中间件的库。这些中间件应该按照一定的顺序执行。在 OWIN 的第一个版本中,有 IAppBuilder界面。然而IAppBuilder不再是 OWIN 的一部分,
我们的 Mvc/WebAPI 解决方案目前有四个我们已在 ADFS3 中注册的可信身份提供者。我们的用户可以通过直接链接使用这些身份提供者中的每一个,有效地解决 ADFS 可能创建的任何家庭领域 co
实际上我知道有关于 KATANA 好处的主题和问题,我知道它们,但我的问题是 Katana 在业务方面可以为我做什么?比如为什么我应该使用 WEB API 作为一个单独的模块(中间件)?它可以与哪个中
IOwinContext 中似乎没有 HTTP Referrer,我需要捕获它。获取该特定变量的正确方法是什么? IOwinContext 有几个 Typed PEM,但我没有特别看到 referer
我正在开发一个使用 Katana 公开自托管 WebAPI 服务的应用程序。我想以类似于 IIS 允许单个网站下的多个应用程序的方式来管理内容。 例如,我可能有三个包含 web api 内容的文件夹:
从 asp.net 6 开始,将没有名为 global.asax 的文件,但 global.asax 有许多事件,例如 · Application_Init · 申请_开始 · Session_Sta
我从 http://blogs.msdn.com/b/webdev/archive/2013/11/22/debugging-owin-app-or-framework.aspx 得到了演示代码,它显
我正在使用 Facebook Owin 身份验证并或多或少地遵循 Microsoft 示例。我或多或少地关注第一次用户登录,一切正常。但如果他们退出并重试,似乎之前的 .AspNet.Correlat
我已经阅读了很多关于此的帖子,但仍然无法使其正常工作。我正在使用 Visual Studio 2013。我创建了一个新的 MVC 5 项目,并认为使用新的 facebook 登录集成会很酷。它在我的
在使用 OWIN 请求管道创建 ApplicationUserManager 时,我在使用依赖注入(inject)创建自定义 UserStore 时遇到问题。 背景 我正在尝试将 Web 应用程序中的
我试图了解 Microsoft.Owin.Security.ActiveDirectory 的用途,但似乎找不到任何文档、测试,甚至 much以文章的方式。 这个包的实际用途是什么?我试图使用它来创建
如果我使用 OwinMiddleware 和 IOwinContext 等 Microsoft.Owin 类型构建 OWIN 中间件,我的中间件是否可以与非 Microsoft Owin 主机/服务器
我在 IIS 7.5 中部署了一个 Owin 中间件身份验证项目作为 Web 应用程序但问题是 Startup.cs 没有被调用。 [assembly: OwinStartup(typeof(Auth
据我所知Microsoft.Owin.Host.SystemWeb允许我在 IIS 上运行 OWIN 应用程序,但今天我发现了另一个名为 Microsoft.Owin.Host.IIS 的包(据我从其
有谁知道将 Owin Asp.Net Identity Cookie 身份验证(本地数据库)与 Owin OpenId 身份验证(云)混合的一个很好的例子?然后用户可以选择通过创建新用户和密码(存
我将 MVC 5 与 OWIN 身份验证一起使用。 这是我的 StartUp.cs 的代码。 public void ConfigureAuth(IAppBuilder app) {
我是一名优秀的程序员,十分优秀!