Add project files.

This commit is contained in:
2025-08-18 17:11:43 +03:30
parent 807dc263be
commit e5eb10d604
3943 changed files with 223719 additions and 0 deletions
@@ -0,0 +1,50 @@
using Elsa.Features.Services;
using FastEndpoints.Swagger;
using Microsoft.AspNetCore.Builder;
namespace Elsa.Extensions
{
/// <summary>
/// Extensions to enable the generation of Swagger API Documentation and associated Swagger UI.
/// </summary>
public static class SwaggerExtensions
{
/// <summary>
/// Registers Swagger document generator.
/// </summary>
public static IModule AddSwagger(this IModule module)
{
Version ver = new(3, 0);
// Swagger API documentation
module.Services.SwaggerDocument(o =>
{
o.EnableJWTBearerAuth = true;
o.DocumentSettings = s =>
{
s.DocumentName = $"v{ver.Major}";
s.Title = "Elsa API";
s.Version = $"v{ver.Major}.{ver.Minor}";
s.AddAuth("ApiKey", new()
{
Name = "Authorization",
In = NSwag.OpenApiSecurityApiKeyLocation.Header,
Type = NSwag.OpenApiSecuritySchemeType.ApiKey,
Description = "Enter: ApiKey [your API key]"
});
};
});
return module;
}
/// <summary>
/// Adds middleware to enable the Swagger UI at '/swagger'
/// </summary>
public static IApplicationBuilder UseSwaggerUI(this IApplicationBuilder app)
{
return app.UseSwaggerGen();
}
}
}