Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
This repository was 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

@henryju

Description

@henryju

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions