From 941838268155c9ae879231517573b9e1c9271d20 Mon Sep 17 00:00:00 2001 From: Nokecy Date: Sun, 15 Oct 2023 18:12:38 +0800 Subject: [PATCH 1/4] update hangfire version to 1.8.5 (#4537) --- src/modules/Elsa.Hangfire/Elsa.Hangfire.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/Elsa.Hangfire/Elsa.Hangfire.csproj b/src/modules/Elsa.Hangfire/Elsa.Hangfire.csproj index 29acaa715..31eee9ba1 100644 --- a/src/modules/Elsa.Hangfire/Elsa.Hangfire.csproj +++ b/src/modules/Elsa.Hangfire/Elsa.Hangfire.csproj @@ -12,8 +12,8 @@ - - + + From fd4af35aa4b0612722a223eccd31030a8493b610 Mon Sep 17 00:00:00 2001 From: solutionmania Date: Sun, 15 Oct 2023 11:24:45 +0100 Subject: [PATCH 2/4] Adds Swagger documentation generation and UI. (#4525) --- .../Elsa.WorkflowServer.Web/Program.cs | 6 ++ .../Extensions/SwaggerExtensions.cs | 57 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 src/common/Elsa.Api.Common/Extensions/SwaggerExtensions.cs diff --git a/src/bundles/Elsa.WorkflowServer.Web/Program.cs b/src/bundles/Elsa.WorkflowServer.Web/Program.cs index 9763936f0..70eafe9fa 100644 --- a/src/bundles/Elsa.WorkflowServer.Web/Program.cs +++ b/src/bundles/Elsa.WorkflowServer.Web/Program.cs @@ -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(); diff --git a/src/common/Elsa.Api.Common/Extensions/SwaggerExtensions.cs b/src/common/Elsa.Api.Common/Extensions/SwaggerExtensions.cs new file mode 100644 index 000000000..30bda9eb8 --- /dev/null +++ b/src/common/Elsa.Api.Common/Extensions/SwaggerExtensions.cs @@ -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 +{ + /// + /// Extensions to enable the generation of Swagger API Documentation and associated Swagger UI. + /// + public static class SwaggerExtensions + { + /// + /// Registers Swagger document generator. + /// + 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; + } + + /// + /// Adds middleware to enable the Swagger UI at '/swagger' + /// + public static IApplicationBuilder UseSwaggerUI(this IApplicationBuilder app) + { + return app.UseSwaggerGen(); + } + + } +} From 22251291b0aa768e4febe51e94891c98c277618a Mon Sep 17 00:00:00 2001 From: bskfrederik <131231567+bskfrederik@users.noreply.github.com> Date: Sun, 15 Oct 2023 12:38:07 +0200 Subject: [PATCH 3/4] bugfix publish workflow results in 415 response (#4517) --- .../src/modules/workflow-definitions/services/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/designer/designer_packages/elsa-workflows-designer/src/modules/workflow-definitions/services/api.ts b/src/designer/designer_packages/elsa-workflows-designer/src/modules/workflow-definitions/services/api.ts index a529fc309..f0634991d 100644 --- a/src/designer/designer_packages/elsa-workflows-designer/src/modules/workflow-definitions/services/api.ts +++ b/src/designer/designer_packages/elsa-workflows-designer/src/modules/workflow-definitions/services/api.ts @@ -17,7 +17,7 @@ export class WorkflowDefinitionsApi { async publish(request: PublishWorkflowDefinitionRequest): Promise { const httpClient = await this.getHttpClient(); - const response = await httpClient.post(`workflow-definitions/${request.definitionId}/publish`); + const response = await httpClient.post(`workflow-definitions/${request.definitionId}/publish`, request); return response.data; } From 29c3151c807847b57ae54589b6f7d19c25648269 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sun, 15 Oct 2023 10:41:01 +0000 Subject: [PATCH 4/4] Updated designer version to 3.0.3-preview.206 --- src/modules/Elsa.Workflows.Designer/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/Elsa.Workflows.Designer/package.json b/src/modules/Elsa.Workflows.Designer/package.json index 11f2b30d7..39e01b373 100644 --- a/src/modules/Elsa.Workflows.Designer/package.json +++ b/src/modules/Elsa.Workflows.Designer/package.json @@ -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",