Kareadita / Kavita

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
http://www.kavitareader.com
GNU General Public License v3.0
5.54k stars 280 forks source link

Accessing the swagger ui throws an exception #3008

Open MFDeAngelo opened 1 week ago

MFDeAngelo commented 1 week ago

What happened?

dotnet --version 8.0.302 Ubuntu 24.04 LTS

Running dotnet run -c Debug in ./API appears to build the application. However, when you attempt to access the swagger UI, you see the following message:

image

What did you expect?

I'd like the Swagger UI to come up, as it will be helpful in testing the API.

Kavita Version Number - If you don not see your version number listed, please update Kavita and see if your issue still persists.

0.8.1 - Stable

What operating system is Kavita being hosted from?

Linux

If the issue is being seen on Desktop, what OS are you running where you see the issue?

None

If the issue is being seen in the UI, what browsers are you seeing the problem on?

No response

If the issue is being seen on Mobile, what OS are you running where you see the issue?

None

If the issue is being seen on the Mobile UI, what browsers are you seeing the problem on?

No response

Relevant log output

[Kavita] [2024-06-19 14:34:25.337 -04:00  6] [Error] API.Middleware.ExceptionMiddleware There was an exception
Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException: Failed to generate Operation for action - API.Controllers.CblController.ValidateCbl (API). See inner exception
 ---> Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException: Error reading parameter(s) for action API.Controllers.CblController.ValidateCbl (API) as [FromForm] attribute used with IFormFile. Please refer to https://github.com/domaindrivendev/Swashbuckle.AspNetCore#handle-forms-and-file-uploads for more information
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateParameters(ApiDescription apiDescription, SchemaRepository schemaRespository)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateOperation(ApiDescription apiDescription, SchemaRepository schemaRepository)
   --- End of inner exception stack trace ---
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateOperation(ApiDescription apiDescription, SchemaRepository schemaRepository)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateOperations(IEnumerable`1 apiDescriptions, SchemaRepository schemaRepository)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GeneratePaths(IEnumerable`1 apiDescriptions, SchemaRepository schemaRepository)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwaggerDocumentWithoutFilters(String documentName, String host, String basePath)
   at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwaggerAsync(String documentName, String host, String basePath)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at API.Middleware.SecurityEventMiddleware.InvokeAsync(HttpContext context) in /home/matthew/Projects/Kavita/API/Middleware/SecurityMiddleware.cs:line 25
   at API.Middleware.ExceptionMiddleware.InvokeAsync(HttpContext context) in /home/matthew/Projects/Kavita/API/Middleware/ExceptionMiddleware.cs:line 18

Additional Notes

No response

DieselTech commented 1 week ago

Sidenote, you can access the swagger docs on our wiki at:

https://www.kavitareader.com/docs/api/#/

DieselTech commented 1 week ago

I can confirm the bug on my setup, but implementing the fix they suggest in the error message breaks file uploads. I'll investigate more into what can be done.