How to Create an API with Minimal APIs | Minimal API upload file

preview_player
Показать описание
How to Create an API with Minimal APIs | Minimal API upload file
Swagger with minimal api? minimal api file upload not working with swagger? IFormFile not working with swagger.

---------------------------------------------------------------
------------------------------------------------------------
To mitigate the issue, we need to use IOperationFilter. This filter helps transforming the operation for swagger. In IOperationFilter for swagger, we need to define the schema for minimal api upload file swagger. we need to check for IFormFile type and in the schema, we need to use OpenApiSchema, OpenApiMediaType classes to define the schema. Once we make all the configuration and run the applicaiton, swagger for minimal apis will show you file uploads. we can add multiple files web api file upload.
Once the files are uploaded, we need to iterate over HttpRequest.Form.Files and save them to the drive.

Chapters
00:00 Intro
00:31 Creating .Net6 Minimal API Project
01:25 Defining .Net6 Minimal API File Upload Endpoint
06:02 Creating Swagger IOperationFilter
12:00 Testing Minimal Api File upload with Swagger

#DotNet6MinimalAPIFileUpload#
#MinimalAPIFileUpload#
#MinimalAPIFileUploadWithSwagger#
Рекомендации по теме
Комментарии
Автор

can we request both files and parameters?

manojihturs