Azure / Azure/data-api-builder
[Bug]: Wrong argument passed when validating stored-procedure query strings
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 370
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 8
Description
## What?
DAB reports “Primary key for POST requests can't be specified…”
instead of “Query string for this HTTP request type is an invalid URL.”
## Why?
```csharp
// (RestService.cs:311)
RequestValidator.ValidatePrimaryKeyRouteAndQueryStringInURL(EntityActionOperation.Insert, queryString);
```
### But the validator signature is:
```csharp
// (RequestValidator.cs:216)
ValidatePrimaryKeyRouteAndQueryStringInURL(operationType, primaryKeyRoute = null, queryString = null)
```
So queryString is being passed into the primaryKeyRoute parameter (positional argument bug), while the real queryString parameter is left null.
## Suggestion
Use named arguments.
```csharp
// RestService.cs:311
ValidatePrimaryKeyRouteAndQueryStringInURL(EntityActionOperation.Insert, primaryKeyRoute: null, queryString: queryString);
```
Contributor guide
Assessment
This issue has not been assessed yet.