Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing Option wrappers from GitPullRequest breaks pull request create #23

Closed
johnbatty opened this issue Aug 22, 2022 · 1 comment · Fixed by #47
Closed

Removing Option wrappers from GitPullRequest breaks pull request create #23

johnbatty opened this issue Aug 22, 2022 · 1 comment · Fixed by #47
Labels
bug Something isn't working

Comments

@johnbatty
Copy link
Collaborator

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!).

@johnbatty johnbatty added the bug Something isn't working label Aug 22, 2022
@johnbatty
Copy link
Collaborator Author

The CreateRepository operation has a GitRepositoryCreateOptions struct. So should probably follow that model and define a new GitPullRequestCreateOptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant