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();
+ }
+
+ }
+}
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;
}
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 @@
-
-
+
+
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",