Fix: Mark catch-all route parameters as optional (#60392) by mapedersen · Pull Request #60544 · dotnet/aspnetcore (original) (raw)

Thank you for the feedback!

I have updated the implementation to use the ApiParameterContext.RouteParameters property along with the IsCatchAll flag to accurately determine which parameter is a catch-all.

With this change, only the parameter explicitly marked as catch-all is treated as optional. This ensures that in a route such as: /products/{category}/items/{group}/inventory/{**any}

only the {**any} parameter is considered optional, while {category} and {group} remain required.

I appreciate your suggestion, as this update better aligns the ApiExplorer behavior with the intended routing semantics.

Please let me know if you have any further feedback.