Merge remote-tracking branch 'origin/v3' into v3
This commit is contained in:
commit
bdb9247961
|
|
@ -160,6 +160,8 @@ services
|
|||
|
||||
// Initialize drop-ins.
|
||||
elsa.InstallDropIns(options => options.DropInRootDirectory = Path.Combine(Directory.GetCurrentDirectory(), "App_Data", "DropIns"));
|
||||
|
||||
elsa.AddSwagger();
|
||||
});
|
||||
|
||||
services.AddHealthChecks();
|
||||
|
|
@ -196,6 +198,10 @@ app.UseJsonSerializationErrorHandler();
|
|||
// Elsa HTTP Endpoint activities
|
||||
app.UseWorkflows();
|
||||
|
||||
// Swagger API documentation
|
||||
if (app.Environment.IsDevelopment())
|
||||
app.UseSwaggerUI();
|
||||
|
||||
// SignalR.
|
||||
app.UseWorkflowsSignalRHubs();
|
||||
|
||||
|
|
|
|||
57
src/common/Elsa.Api.Common/Extensions/SwaggerExtensions.cs
Normal file
57
src/common/Elsa.Api.Common/Extensions/SwaggerExtensions.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
using Elsa.Features.Services;
|
||||
using FastEndpoints.Swagger;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
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 = false;
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ export class WorkflowDefinitionsApi {
|
|||
|
||||
async publish(request: PublishWorkflowDefinitionRequest): Promise<WorkflowDefinition> {
|
||||
const httpClient = await this.getHttpClient();
|
||||
const response = await httpClient.post<WorkflowDefinition>(`workflow-definitions/${request.definitionId}/publish`);
|
||||
const response = await httpClient.post<WorkflowDefinition>(`workflow-definitions/${request.definitionId}/publish`, request);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Hangfire" Version="1.7.33" />
|
||||
<PackageReference Include="Hangfire.MemoryStorage" Version="1.7.0" />
|
||||
<PackageReference Include="Hangfire" Version="1.8.5" />
|
||||
<PackageReference Include="Hangfire.MemoryStorage" Version="1.8.0" />
|
||||
<PackageReference Include="Hangfire.Storage.SQLite" Version="0.3.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"build:debug": "cross-env webpack --mode=development --env configuration=Debug"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@elsa-workflows/elsa-workflows-designer": "3.0.3-preview.205",
|
||||
"@elsa-workflows/elsa-workflows-designer": "3.0.3-preview.206",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"monaco-editor": "^0.36.1",
|
||||
|
|
|
|||
Loading…
Reference in a new issue