Skip to content

RemoveReviewers API: omitempty on required reviewers field causes spurious 422s #3336

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

Closed
nagl-resourcely opened this issue Oct 25, 2024 · 2 comments

Comments

@nagl-resourcely
Copy link
Contributor

nagl-resourcely commented Oct 25, 2024

Summary

Calling RemoveReviewers when you want to only remove teams elicits a 422, due to how omitempty prevents the golang client from serializing the empty reviewers slice. This field is required on the server, so the golang client needed to send reviewers: [].

Workaround

Work around this by exploiting delete idempotency =) Just pass it a bogus username alongside real team slugs.

@gmlewis
Copy link
Collaborator

gmlewis commented Oct 25, 2024

EDIT: Ah! I see it now.
OK, gotcha.

Would you like to create a PR to fix this issue, @nagl-resourcely ?

@nagl-resourcely
Copy link
Contributor Author

Heh, that probably would have been faster than typing up the issue. Sure - I'll send one after the workday ends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants