From 1c20b8fbb4951958f4c1598ccce870ecd03ecf2d Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Sat, 26 Jun 2021 11:19:34 +0200 Subject: [PATCH] Rename SaveRequest models to fix ambiguity for Swagger Fixes #1178 --- .../Endpoints/WebhookDefinitions/Models.cs | 2 +- .../Endpoints/WebhookDefinitions/Post.cs | 5 ++--- .../Endpoints/WebhookDefinitions/Put.cs | 2 +- .../Endpoints/WorkflowDefinitions/Save.Request.cs | 2 +- .../Elsa.Server.Api/Endpoints/WorkflowDefinitions/Save.cs | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/activities/webhooks/Elsa.Activities.Webhooks/Endpoints/WebhookDefinitions/Models.cs b/src/activities/webhooks/Elsa.Activities.Webhooks/Endpoints/WebhookDefinitions/Models.cs index 73e2ca645..e88c858ab 100644 --- a/src/activities/webhooks/Elsa.Activities.Webhooks/Endpoints/WebhookDefinitions/Models.cs +++ b/src/activities/webhooks/Elsa.Activities.Webhooks/Endpoints/WebhookDefinitions/Models.cs @@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations; namespace Elsa.Activities.Webhooks.Endpoints.WebhookDefinitions { - public sealed record SaveRequest + public sealed record SaveWebhookDefinitionRequest { public string? Id { get; init; } [Required] public string Path { get; init; } = default!; diff --git a/src/activities/webhooks/Elsa.Activities.Webhooks/Endpoints/WebhookDefinitions/Post.cs b/src/activities/webhooks/Elsa.Activities.Webhooks/Endpoints/WebhookDefinitions/Post.cs index 4fc5089b1..2bccae227 100644 --- a/src/activities/webhooks/Elsa.Activities.Webhooks/Endpoints/WebhookDefinitions/Post.cs +++ b/src/activities/webhooks/Elsa.Activities.Webhooks/Endpoints/WebhookDefinitions/Post.cs @@ -33,12 +33,11 @@ namespace Elsa.Activities.Webhooks.Endpoints.WebhookDefinitions [SwaggerResponseExample(StatusCodes.Status200OK, typeof(WebhookDefinitionExample))] [SwaggerOperation( Summary = "Creates a new webhook definition or updates an existing one.", - Description = - "Creates a new webhook definition or updates an existing one.", + Description = "Creates a new webhook definition or updates an existing one.", OperationId = "WebhookDefinitions.Post", Tags = new[] { "WebhookDefinitions" }) ] - public async Task> Handle([FromBody] SaveRequest request, [FromRoute] ApiVersion apiVersion, CancellationToken cancellationToken) + public async Task> Handle([FromBody] SaveWebhookDefinitionRequest request, [FromRoute] ApiVersion apiVersion, CancellationToken cancellationToken) { var webhookId = request.Id; var webhookDefinition = !string.IsNullOrWhiteSpace(webhookId) ? await _store.FindAsync(new EntityIdSpecification(webhookId), cancellationToken) : default; diff --git a/src/activities/webhooks/Elsa.Activities.Webhooks/Endpoints/WebhookDefinitions/Put.cs b/src/activities/webhooks/Elsa.Activities.Webhooks/Endpoints/WebhookDefinitions/Put.cs index c3c0af6e6..cb26304ca 100644 --- a/src/activities/webhooks/Elsa.Activities.Webhooks/Endpoints/WebhookDefinitions/Put.cs +++ b/src/activities/webhooks/Elsa.Activities.Webhooks/Endpoints/WebhookDefinitions/Put.cs @@ -30,7 +30,7 @@ namespace Elsa.Activities.Webhooks.Endpoints.WebhookDefinitions OperationId = "WebhookDefinitions.Put", Tags = new[] { "WebhookDefinitions" }) ] - public async Task> Handle([FromBody] SaveRequest request, [FromRoute] ApiVersion apiVersion, CancellationToken cancellationToken) + public async Task> Handle([FromBody] SaveWebhookDefinitionRequest request, [FromRoute] ApiVersion apiVersion, CancellationToken cancellationToken) { var webhookId = request.Id; var webhookDefinition = await _store.FindAsync(new EntityIdSpecification(webhookId), cancellationToken); diff --git a/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Save.Request.cs b/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Save.Request.cs index 2633b8fcd..70b043293 100644 --- a/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Save.Request.cs +++ b/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Save.Request.cs @@ -5,7 +5,7 @@ namespace Elsa.Server.Api.Endpoints.WorkflowDefinitions { public partial class Save { - public sealed record SaveRequest + public sealed record SaveWorkflowDefinitionRequest { public string? WorkflowDefinitionId { get; init; } public string? Name { get; init; } diff --git a/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Save.cs b/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Save.cs index 8e73b2a6b..4b19c7f2e 100644 --- a/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Save.cs +++ b/src/server/Elsa.Server.Api/Endpoints/WorkflowDefinitions/Save.cs @@ -35,7 +35,7 @@ namespace Elsa.Server.Api.Endpoints.WorkflowDefinitions OperationId = "WorkflowDefinitions.Post", Tags = new[] { "WorkflowDefinitions" }) ] - public async Task> Handle([FromBody]SaveRequest request, [FromRoute]ApiVersion apiVersion, CancellationToken cancellationToken) + public async Task> Handle([FromBody]SaveWorkflowDefinitionRequest request, [FromRoute]ApiVersion apiVersion, CancellationToken cancellationToken) { var workflowDefinitionId = request.WorkflowDefinitionId; var workflowDefinition = !string.IsNullOrWhiteSpace(workflowDefinitionId) ? await _workflowPublisher.GetDraftAsync(workflowDefinitionId, cancellationToken) : default; @@ -68,7 +68,7 @@ namespace Elsa.Server.Api.Endpoints.WorkflowDefinitions return CreatedAtAction("Handle", "GetByVersionId", new { versionId = workflowDefinition.Id, apiVersion = apiVersion.ToString() }, workflowDefinition); } - private IEnumerable FilterInvalidConnections(SaveRequest request) + private IEnumerable FilterInvalidConnections(SaveWorkflowDefinitionRequest request) { var validConnections = from connection in request.Connections