Skip to content

ApiExplorer does not correctly populate parameters for IApiDescriptionGroupCollectionProvider when modelbinding is used #27671

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

Closed
statler opened this issue Nov 10, 2020 · 1 comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved

Comments

@statler
Copy link

statler commented Nov 10, 2020

ApiDescriptionProblem (2).zip

Describe the bug

When using [modelbinder] attribute, the ApiExplorer does not correctly populate for parameters of a controller method

To Reproduce

Populate the API Explorer for a parameter that uses [modelbinder]. Instead of the parameterDescriptions being enumerated in the ApiDescription as happened in .Net Core 2.2, the ApiDescription contains only the name of the parameter.

In the attached project, run it and put a breakpoint in the constructor of SampleDataController. The property group contains 2 items. The first uses modelbinding and has one parameter whereas the second directly maps to the bound model and has the expected 21.

Exceptions (if any)

None

Further technical details

  • ASP.NET Core version 3.1
  • Include the output of dotnet --info
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version VS 19 (16.7.7)
@javiercn javiercn added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Nov 10, 2020
@pranavkm
Copy link
Contributor

@statler this is likely a dup of #4825. Model binding as opposed to input formatting uses a wire format that is tied to how MVC functions. It's a bit difficult to map that to a swagger spec. Custom binders make it more complex since the author of the binder has to describe the wire format to MVC.

For APIs, we would generally recommend using JSON as the wire format to get a reasonable Swagger experience. We'll continue using the linked issue to track further work here.

@pranavkm pranavkm added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Nov 10, 2020
@ghost ghost added the Status: Resolved label Nov 10, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Projects
None yet
Development

No branches or pull requests

3 participants