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
Swagger generator fails to document API endpoint with multiple IFormFile parameters #2817
Comments
Can you clarify which it is please? Is it creating a swagger.json file with a missing operation, or is it failing to generate the document at all? If the latter, what exceptions/errors are logged by the server, if any? |
It throws this exception:
|
Could you provide the full stack trace please? Then it should be much easier for us to find the source of the problem. |
An unhandled exception occurred while processing the request. SwaggerGeneratorException: Failed to generate Operation for action - TestApiForTestingSwashbuckle.Controllers.WeatherForecastController.DummyAction (TestApiForTestingSwashbuckle). See inner exception Stack: |
Thanks. In future for GitHub issues, please provide details as text not screenshots. Text is much more useful for others as it can be searched, indexed, copied etc. |
Exception is coming from this line: Swashbuckle.AspNetCore/src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGenerator.cs Line 538 in a17b464
|
Turns out this is "expected" behaviour. We might be able to improve this scenario anyway though so if it still fails it's at least more informative. |
Thank you @martincostello. removing FromForm attributes obviates the exception and also files become uploaded without problem. |
When defining an API endpoint in an ASP.NET Core Web API with multiple parameters of type IFormFile, the Swagger generator fails to generate the swagger.json file for the endpoint. The issue occurs when attempting to upload multiple files using IFormFile parameters in the API action.
Steps to Reproduce:
Code Snippet:
The text was updated successfully, but these errors were encountered: