Azure / Azure/azure-rest-api-specs
[BUG]GetPullRequest Endpoint returned data not as specified
- 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/pull-requests/get-pull-request?view=azure-devops-rest-7.1
### API Spec version
7.1
### Describe the bug
despite the includeCommits option being passed along as "true" there is no detailed information about the commits available (only links to the commit; no Change count dictionary; no gitchange object...)
### Expected behavior
as specified
### Actual behavior
this is one example entry in the pullRequestsFromForkExtended list that is generated in the code snippet in the reproduction steps
```
{'repository': {'id': 'cdebd4b6-9bfa-4218-bb64-2daea2d2d543', 'name': 'tracabilityMapAndMetricsGenerator.Fork3', 'url': 'https://dev.azure.com/Clarios/680dfb46-9cac-413f-9ab1-57a87a6f63ac/_apis/git/repositories/cdebd4b6-9bfa-4218-bb64-2daea2d2d543', 'project': {...}, 'size': 32042, 'remoteUrl': 'https://Clarios@dev.azure.com/Clarios/SW_Tools/_git/tracabilityMapAndMetricsGenerator.Fork3', 'sshUrl': 'git@ssh.dev.azure.com:v3/Clarios/SW_Tools/tracabilityMapAndMetricsGenerator.Fork3', 'webUrl': 'https://dev.azure.com/Clarios/SW_Tools/_git/tracabilityMapAndMetricsGenerator.Fork3', 'isFork': True, 'isDisabled': False, 'isInMaintenance': False}, 'pullRequestId': 39888, 'codeReviewId': 39888, 'status': 'completed', 'createdBy': {}, 'creationDate': '2025-11-26T10:42:34.2763747Z', 'closedDate': '2025-11-26T10:45:02.4820572Z', 'title': 'merge branch from fork2 into fork3', 'description': 'Updated pyproject.toml', 'sourceRefName': 'refs/pull/39888/source', 'targetRefName': 'refs/heads/master', 'mergeStatus': 'succeeded', 'isDraft': False, 'mergeId': '569ea276-b697-4e6d-905d-b0d169bac49f', 'lastMergeSourceCommit': {'commitId': '858c1edcd72a98cd70c8c7e4b36e4fb96ff58cd8', 'url': 'https://dev.azure.com/Clarios/680dfb46-9cac-413f-9ab1-57a87a6f63ac/_apis/git/reposito...s/858c1edcd72a98cd70c8c7e4b36e4fb96ff58cd8'}, 'lastMergeTargetCommit': {'commitId': '8899da63e280371ea73078096f0740c12f4fa8c4', 'url': 'https://dev.azure.com/Clarios/680dfb46-9cac-413f-9ab1-57a87a6f63ac/_apis/git/reposito...s/8899da63e280371ea73078096f0740c12f4fa8c4'}, 'lastMergeCommit': {'commitId': '0fe61047718abff63d983ac6ae7e44bb15b48028', 'author': {...}, 'committer': {...}, 'comment': 'Merged PR 39888: merge branch from fork2 into fork3', 'commentTruncated': True, 'url': 'https://dev.azure.com/Clarios/680dfb46-9cac-413f-9ab1-57a87a6f63ac/_apis/git/reposito...s/0fe61047718abff63d983ac6ae7e44bb15b48028'}, 'reviewers': [], 'url': 'https://dev.azure.com/Clarios/680dfb46-9cac-413f-9ab1-57a87a6f63ac/_apis/git/reposito...-4218-bb64-2daea2d2d543/pullRequests/39888', '_links': {'self': {...}, 'repository': {...}, 'workItems': {...}, 'sourceBranch': {...}, 'targetBranch': {...}, 'statuses': {...}, 'sourceCommit': {...}, 'targetCommit': {...}, 'mergeCommit': {...}, 'createdBy': {...}, 'iterations': {...}}, 'completionOptions': {'mergeCommitMessage': 'Merged PR 39888: merge branch from fork2 into fork3\n\nUpdated pyproject.toml', 'mergeStrategy': 'noFastForward', 'autoCompleteIgnoreConfigIds': [...]}, 'supportsIterations': True, 'completionQueueTime': '2025-11-26T10:45:01.7243348Z', 'closedBy': {}, 'artifactId': 'vstfs:///Git/PullRequestId/680dfb46-9cac-413f-9ab1-57a87a6f63ac%2fcdebd4b6-9bfa-4218-bb64-2daea2d2d543%2f39888', 'forkSource': {'repository': {...}, 'name': 'refs/heads/branch1', 'objectId': None, 'creator': None, 'url': None}}
```
### Reproduction Steps
assume the following python snippet
```
pullRequests.extend(applicationContext.devops.getAllPullRequests(repositoryID, extraQueryOptions=[("searchCriteria.status", "all")]))
pullRequestsFromFork = list(filter(lambda x: "forkSource" in x.keys(), pullRequests))
pullRequestsFromForkExtended = []
for i in range(0, len(pullRequestsFromFork)):
pullRequestsFromForkExtended.append(applicationContext.devops.getPullRequest(pullRequestsFromFork[i]["pullRequestId"], pullRequestsFromFork[i]["repository"]["id"], extraQueryOptions=[("includeCommits", "true"), ("includeWorkItemRefs", "true")]))
```
where the functions are defined as
```
def getPullRequest(self, pullRequestID : int, repositoryID : str, project : Optional[str] = "", extraQueryOptions : Optional[list[tuple[str, Any]]] = []):
return self._synchronizedExec(self.getPullRequestAsync(pullRequestID, repositoryID, project))
async def getPullRequestAsync(self, pullRequestID : int, repositoryID : str, project : Optional[str] = "", extraQueryOptions : Optional[list[tuple[str, Any]]] = []):
response = await self._performAsyncRequestWithRetries(
self.httpxClient.get,
self._urlFactory(
f"{project}/_apis/git/repositories/{repositoryID}/pullrequests/{pullRequestID}",
[("api-version", self.usedAPIVersion)] + extraQueryOptions
)
)
return response.json()
```
### Environment
_No response_
Contributor guide
Research direction
Start with the linked Microsoft Azure DevOps Get Pull Request API specification, version 7.1, and the shown Python getPullRequestAsync call. Compare the response returned with includeCommits=true against the documented schema, then confirm whether the specification or the reported behavior needs correction; done means the discrepancy has a clearly supported resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100