WebApi
WebApi copied to clipboard
ActionDescriptor for OData Controller with optional parameters not selected
When a controller has optional parameters, its ActionDescriptor is not getting selected.
Assemblies affected
7.5.17
Reproduce steps
Sample request: https://nebulaapi.azurefd.net/odata/insights/partner?type=account&entityType=TPID&$count=true&impersonate=88843e2a-7c59-4a0b-a073-84b9568f4869 Corresponding controller signature: public async Task<ActionResult<IEnumerable<IEdmEntityObject>>> Get(string type, string entityIds, string entityType, Guid impersonate, CancellationToken cancellationToken, bool dataCount = false)
Due to the optional parameter, the SDK method of ODataActionSelector.SelectBestCandidate() does not return any ActionDescriptor. The API call doesnt reach the controller. Request fails with exception
Expected result
API call should reach the Get method in the controller.
Actual result
The API call doesnt reach the controller. Request fails with exception