WebApi icon indicating copy to clipboard operation
WebApi copied to clipboard

ActionDescriptor for OData Controller with optional parameters not selected

Open debaksi opened this issue 3 years ago • 0 comments

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

Additional detail

debaksi avatar Oct 17 '22 17:10 debaksi