我正在将 Swaschbuckle 用于我的 .NET Swagger Web API 服务。
我看过来自的样本http://petstore.swagger.io/#/pet http://petstore.swagger.io/#/pet还有一个动作 findByTags 被划掉了。
我想划掉 api 服务中的某个操作,但是当我使用过时的属性时,该操作不可见。
知道如何处理这个问题吗?
我的 WebApi 项目遇到了同样的问题,但在将 Swashbuckle.Core nuget 包更新到版本 5.6.0 后,它开始工作。
我有一个 SwaggerConfig 类,如下所示:
public static class SwaggerConfig
{
public static void Register(HttpConfiguration configuration)
{
configuration.EnableSwagger(Configure).EnableSwaggerUi(ConfigureUi);
}
static void Configure(SwaggerDocsConfig config)
{
config.SingleApiVersion("V1", "MichalBialecki.com.Swagger.Example");
config.UseFullTypeNameInSchemaIds();
}
static void ConfigureUi(SwaggerUiConfig config)
{
config.DocExpansion(DocExpansion.None);
config.DisableValidator();
}
}
您还需要在 Startup.cs 中注册它:
SwaggerConfig.Register(config);
并使用 ApiController 中的方法,如下所示:
[HttpGet]
[Obsolete("This method is obsolete, please use /accounts/{accountId}")]
[Route("personalAccount/{accountId}")]
public AccountDTO GetPersonalAccount(int accountId)
I can see in Swagger, that it is stroked out:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)