Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Elsa 2 swagger error for IFormFile #6319

Open
JoschaMetze opened this issue Jan 21, 2025 · 0 comments
Open

[BUG] Elsa 2 swagger error for IFormFile #6319

JoschaMetze opened this issue Jan 21, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@JoschaMetze
Copy link

Description

Generating a swagger api doc with the latest swashbuckle (Swashbuckle.AspNetCore.SwaggerGen 6.6.2) will cause a generation error due to the use of [FromForm] IFormFile in the WorkflowDefinition Import and Restore-Controller.

Steps to Reproduce

To help us identify the issue more quickly, please follow these guidelines:

Update sample to latest swashbuckle and try to produce swagger documentation, the following exception will occur:
Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException: Failed to generate Operation for action - Elsa.Server.Api.Endpoints.WorkflowDefinitions.Import.Handle (Elsa.Server.Api). See inner exception ---> Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException: Error reading parameter(s) for action Elsa.Server.Api.Endpoints.WorkflowDefinitions.Import.Handle (Elsa.Server.Api) as [FromForm] attribute used with IFormFile. Please refer to https://github.com/domaindrivendev/Swashbuckle.AspNetCore#handle-forms-and-file-uploads for more information

If you follow the link you will find documentation that [FromForm] should not be used with IFormFile. Removing the attribute solves the issue.

Relevant code signature:
public async Task<IActionResult> Handle(string workflowDefinitionId, [FromForm] IFormFile? file, CancellationToken cancellationToken) {

Thanks for looking into this.

@JoschaMetze JoschaMetze added the bug Something isn't working label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant