/SwashbuckleSwagger

AspNetCore customer swagger filters and attributes based on Swashbuckle

Primary LanguageC#MIT LicenseMIT

AoiHosizora.Swagger

Functions

  • FileUpload
  • SecurityApiKey
  • DefaultValue
  • Model
  • Property

Usage

services.AddSwaggerGen(options => {
    // ...
    options.EnableAnnotations();
    options.AddSecurityDefinition("secret", new OpenApiSecurityScheme { // demo
        Type = SecuritySchemeType.ApiKey,
        In = ParameterLocation.Header,
        Name = "Authorization"
    });
    options.EnableAoiHosizoraSwaggerAnnotations();
});
// demo for SecurityApiKey
[HttpGet("test")]
[SwaggerSecurityApiKey("secret")]
// [Authorize]
public IActionResult Test() { }

Required

  • .NETCore >= 3.0

Install

# Package manager
Install-Package AoiHosizora.Swagger -Version 1.0.3

# .NET CLI
dotnet add package AoiHosizora.Swagger --version 1.0.3

Reference