dotnet / dotnet/aspnetcore

Fix ApiExplorer metadata for FormFiles/Stream/PipeReader in MVC actions

Open
#55,349 2 comments 0 reactions 0 assignees View on GitHub
area-mvc feature-openapi
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

MVC uses the `FormFileModelBinder` ([ref](https://source.dot.net/#Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/FormFileModelBinder.cs,0ed8e2ee0a654a1a)) to support binding for `IFormFile`, `IFormFileCollection`, and `IEnumerable`.

When this is the case, the ApiExplorer layer will produce 6 distinct parameter descriptions for each property within the IFormFile type:

image

This is distinct from the descriptions that are generated for minimal APIs which correctly produces the correct binding sources for form file parameters (see https://github.com/dotnet/aspnetcore/blob/main/src/Mvc/Mvc.ApiExplorer/src/EndpointMetadataApiDescriptionProvider.cs#L305). We should update the MVC implementation of ApiExplorer to do the right thing.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.