-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routing
Milestone
Description
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:
app.MapGet("/action/{foo?}", (string? foo) => ...)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:
app.MapGet("/action/{foo?}", (string foo) => ...);This feature can be achieved by examining the values of factoryContext.RouteParameterNames and factoring it into the data binding done in BindParametersFromQueryOrRouteValue.
danroth27 and rgwood
Metadata
Metadata
Assignees
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routing