Skip to content

Removing Option wrappers from GitPullRequest breaks pull request create #23

Closed
@johnbatty

Description

@johnbatty

The git::pull_requests create() function takes a GitPullRequest struct, which is the same struct returned when querying pull requests. There are many fields in here which are created/managed by the server (e.g. id, url).

I removed a bunch of Option wrappers on GitPullRequest to make the returned pull request struct easier to use (see #6), including the id and url fields. However these values obviously cannot/should not be provided when creating a pull request.

The simple fix is to back out the changes that make these fields required (i.e. restoring option wrappers). However, this isn't ideal as the set of mandatory and optional fields on creation is not encoded/enforced by the crate types. A better solution would therefore to be to replace the create parameter type with a new struct that contains only the valid parameters for pull request create operations. This is fairly easy to implement via vsts-api-patcher. Figuring out which fields are valid on a pull request create operation is another matter (as it isn't defined by the API docs!).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions