Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Unable to create a pull request status without passing an iterationId #21

Open
henryju opened this issue Feb 15, 2018 · 0 comments
Open

Comments

@henryju
Copy link

henryju commented Feb 15, 2018

According to the documentation, it should be possible to create a PR status without specifying an iterationId: https://www.visualstudio.com/en-us/docs/integrate/api/git/pull-requests/pullrequeststatuses

Pull request statuses can be posted on the overall pull request or on the specific pull request iteration.

It is said that you can pass the iterationId, not that you should

Note that you can specify iterationId in the request body to post the status on the iteration.

But if I try:

    GitPullRequestStatus status = new GitPullRequestStatus();
    GitStatusContext context = new GitStatusContext();
    context.setGenre("Foo");
    context.setName("Bar");
    status.setContext(context);
    status.setState(statusState);
    status.setDescription(statusDescription);
    status.setTargetUrl(targetUrl);
    // Don't set iterationId on the status
    gitHttpClient.createPullRequestStatus(status, gitRepo.getId(), pullRequest.getPullRequestId());

It fails with:

com.microsoft.alm.client.model.VssServiceException: The value 0 is outside of the allowed range.
Parameter name: iterationId
Actual value was 0.
at com.microsoft.alm.visualstudio.services.webapi.WrappedException.Unwrap(WrappedException.java:193)
at com.microsoft.alm.client.VssHttpClientBase.handleResponse(VssHttpClientBase.java:235)
at com.microsoft.alm.client.VssHttpClientBase.sendRequest(VssHttpClientBase.java:213)
at com.microsoft.alm.client.VssHttpClientBase.sendRequest(VssHttpClientBase.java:218)
at com.microsoft.alm.teamfoundation.sourcecontrol.webapi.GitHttpClientBase.createPullRequestStatus(GitHttpClientBase.java:11472)

I think the problem com from the fact that GitPullRequestStatus#iterationId should be an Integer and accept null values.

henryju added a commit to SonarSource/vso-httpclient-java that referenced this issue Feb 15, 2018
henryju added a commit to SonarSource/vso-httpclient-java that referenced this issue Feb 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant