Azure / Azure/azure-rest-api-specs

[BUG]Get CommitsBatch query parameter top not handled correctly

Open
#37,531 0 comments 0 reactions 0 assignees View on GitHub
bug customer-reported question
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

### API Spec link

https://learn.microsoft.com/en-us/rest/api/azure/devops/git/commits/get-commits-batch?view=azure-devops-rest-7.2&tabs=HTTP

### API Spec version

7.1

### Describe the bug

the query parameter $top is not handled correctly when present (reported as bool but documentation claims it to be int32)

it is also not handled correctly when set to true (which would be a valid bool value) --> in that scenario the parameter seems to be handled as repository name

this happens indifferent of the presence/absence of the top parameter in the json body

this issue is been noticed when trying to work around #37530 (so for the older/newer relation of the given commits see there)

### Expected behavior

to match the documentation -- possibly throw an error if the parameter is passed in both in query AND body

### Actual behavior

```
$ curl -H "authorization: bearer $token" -H "content-type: application/json" -X POST "https://dev.azure.com/Clarios/SW_Euler/_apis/git/repositories/Euler/commitsbatch?api-version=7.1&$top=50000" --data
'{"compareVersion":{"version":"65a7bc018019d195f14542ce6b36c32f0ccad79c", "versionOptions":"none", "versionType":"commi
t"}, "itemVersion" : {"version":"d926c886eaa6bc5e765840f77c8cbfbd82db1910", "versionOptions":"none", "versionType":"comm
it"}, "$top": 50000}' | jq > response.json && head response.json && tail response.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 339 100 81 100 258 180 575 --:--:-- --:--:-- --:--:-- 755
{
"count": 1,
"value": {
"Message": "The value '50000' is not valid for Boolean.\r\n"
}
}
{
"count": 1,
"value": {
"Message": "The value '50000' is not valid for Boolean.\r\n"
}
}

```

```
$ curl -H "authorization: bearer $token" -H "content-type: application/json" -X POST "https://dev.azure.com/Clarios/SW_Euler/_apis/git/repositories/Euler/commitsbatch?api-version=7.1&$top=true" --data
'{"compareVersion":{"version":"65a7bc018019d195f14542ce6b36c32f0ccad79c", "versionOptions":"none", "versionType":"commit
"}, "itemVersion" : {"version":"d926c886eaa6bc5e765840f77c8cbfbd82db1910", "versionOptions":"none", "versionType":"commi
t"}, "$top": 50000}' | jq > response.json && head response.json && tail response.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 634 100 376 100 258 1051 721 --:--:-- --:--:-- --:--:-- 1770
{
"$id": "1",
"innerException": null,
"message": "TF401019: The Git repository with name or identifier true does not exist or you do not have permissions for the operation you are attempting.",
"typeName": "Microsoft.TeamFoundation.Git.Server.GitRepositoryNotFoundException, Microsoft.TeamFoundation.Git.Server",
"typeKey": "GitRepositoryNotFoundException",
"errorCode": 0,
"eventId": 3000
}
{
"$id": "1",
"innerException": null,
"message": "TF401019: The Git repository with name or identifier true does not exist or you do not have permissions for the operation you are attempting.",
"typeName": "Microsoft.TeamFoundation.Git.Server.GitRepositoryNotFoundException, Microsoft.TeamFoundation.Git.Server",
"typeKey": "GitRepositoryNotFoundException",
"errorCode": 0,
"eventId": 3000
}
```

```
$ curl -H "authorization: bearer $token" -H "content-type: application/json" -X POST "https://dev.azure.com/Clarios/SW_Euler/_apis/git/repositories/Euler/commitsbatch?api-version=7.1&$top=true" --data '{"compareVersion":{"version":"65a7bc018019d195f14542ce6b36c32f0ccad79c", "versionOptions":"none", "versionType":"commit"}, "itemVersion" : {"version":"d926c886eaa6bc5e765840f77c8cbfbd82db1910", "versionOptions":"none", "versionType":"commit"}}' | jq > response.json && head response.json && tail response.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 619 100 376 100 243 499 322 --:--:-- --:--:-- --:--:-- 822
{
"$id": "1",
"innerException": null,
"message": "TF401019: The Git repository with name or identifier true does not exist or you do not have permissions for the operation you are attempting.",
"typeName": "Microsoft.TeamFoundation.Git.Server.GitRepositoryNotFoundException, Microsoft.TeamFoundation.Git.Server",
"typeKey": "GitRepositoryNotFoundException",
"errorCode": 0,
"eventId": 3000
}
{
"$id": "1",
"innerException": null,
"message": "TF401019: The Git repository with name or identifier true does not exist or you do not have permissions for the operation you are attempting.",
"typeName": "Microsoft.TeamFoundation.Git.Server.GitRepositoryNotFoundException, Microsoft.TeamFoundation.Git.Server",
"typeKey": "GitRepositoryNotFoundException",
"errorCode": 0,
"eventId": 3000
}
```

### Reproduction Steps

can be taken from actual behavior snippet

### Environment

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating the Azure DevOps Git commitsbatch API specification for version 7.1 and inspect how the $top query parameter and repository route are defined. Reproduce the reported curl requests, then verify that numeric $top values are accepted, boolean values are rejected or handled as documented, and the repository name is no longer read as true.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.