Skip to content

Swagger generation for Simplify.Web web-framework controllers

License

Notifications You must be signed in to change notification settings

SimplifyNet/Simplify.Web.Swagger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simplify.Web.Swagger

Nuget Version Nuget Download Build Package Libraries.io dependency status for latest release CodeFactor Grade Platform PRs Welcome

Simplify.Web.Swagger is a package which provides Swagger generation for Simplify.Web web-framework controllers.

Quick Start

  1. Add Simplify.Web.Swagger, Swashbuckle.AspNetCore.SwaggerGen and Swashbuckle.AspNetCore.SwaggerUI packages to your project
<PackageReference Include="Simplify.Web.Swagger" Version="1.0.*" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.6.*" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.6.*" />
  1. Add AddSimplifyWebSwagger in AddSwaggerGen registration and Simplify.Web controllers will be scanned during Swagger generation process.
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddEndpointsApiExplorer()
 .AddSwaggerGen(x => x.AddSimplifyWebSwagger());
  1. Use Swagger as in regular ASP.NET Core project
var app = builder.Build();

app.UseSwagger();
app.UseSwaggerUI();

app.UseSimplifyWeb();

await app.RunAsync();
  1. Add controller Swagger attributes (if needed)
[Get("/api/v1/users/{id}")]
[ApiVersion("1.0")]
[ProducesResponse(StatusCodes.Status200OK, "application/json")]
[ProducesResponse(StatusCodes.Status500InternalServerError)]
public class GetController : Controller2
{
 ...
}
  1. After application started go to http://localhost:5000/swagger/index.html or http://localhost:5000/swagger/v1/swagger.json to see generated Swagger

Example application

Below is the example of Swagger generated by Simplify.Web.Swagger:

Simplify

Contributing

There are many ways in which you can participate in the project. Like most open-source software projects, contributing code is just one of many outlets where you can help improve. Some of the things that you could help out with are:

  • Documentation (both code and features)
  • Bug reports
  • Bug fixes
  • Feature requests
  • Feature implementations
  • Test coverage
  • Code quality
  • Sample applications

Related Projects

Additional extensions to Simplify.Web live in their own repositories on GitHub. For example:

License

Licensed under the GNU LESSER GENERAL PUBLIC LICENSE