想知道-exactwith的使用--save
npm i typescript@3.4 --save-dev --save-exact
Run Code Online (Sandbox Code Playgroud) 我已经在我们的asp.core wep-api项目中配置了 swagger并且它工作得非常好。现在我正在研究当swagger-ui出现时的解决方案,如下所示
api 版本部分应根据代码端的配置自动填充。
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info
{
Version = "v1",
Title = "My API",
Contact = new Contact
{
Name = "My Api",
Url = "https://109.com/"
}
});
var security = new Dictionary<string, IEnumerable<string>>
{
{"Bearer", new string[] { }},
};
c.AddSecurityDefinition("Bearer", new ApiKeyScheme
{
Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
Name = "Authorization",
In = "header",
Type = "apiKey"
});
c.AddSecurityRequirement(security);
});
Run Code Online (Sandbox Code Playgroud)