Skip to content

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

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

Open
captainsafia opened this issue Apr 24, 2024 · 2 comments
Open
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-openapi

Comments

@captainsafia
Copy link
Member

MVC uses the FormFileModelBinder (ref) to support binding for IFormFile, IFormFileCollection, and IEnumerable<FormFile>.

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.

@ghost ghost added the old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels label Apr 24, 2024
@captainsafia captainsafia added this to the 9.0-preview5 milestone Apr 24, 2024
@captainsafia captainsafia added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-openapi and removed old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels labels Apr 24, 2024
@captainsafia
Copy link
Member Author

captainsafia commented Apr 25, 2024

This issue also occurs with Stream and PipeReader inputs in MVC which are handled by the BodyModelBinder and end up being splatted out into the public properties on each respective type.

@captainsafia captainsafia changed the title Fix ApiExplorer metadata for FormFiles in MVC actions Fix ApiExplorer metadata for FormFiles/Stream/PipeReader in MVC actions Apr 25, 2024
@mkArtakMSFT
Copy link
Contributor

Removing the milestone to retriage.

@mkArtakMSFT mkArtakMSFT removed this from the 9.0-preview5 milestone Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-openapi
Projects
None yet
Development

No branches or pull requests

2 participants