Create an analyzer to detect mismatched parameter optionality #34553
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
feature-minimal-actions
Controller-like actions for endpoint routing
Milestone
As a follow-up to the work completed in #34505, we should add support for labeling optional parameters in a route using the route string. For example:
Will treat the
foo
parameter as optional in the endpoint above. For scenarios where the optionality defined in the route and the optionality defined in the method differ, then we will throw an exception. For example, the route string below defines a parameter as optional but the method defines it as required:This feature can be achieved by examining the values of
factoryContext.RouteParameterNames
and factoring it into the data binding done inBindParametersFromQueryOrRouteValue
.The text was updated successfully, but these errors were encountered: