Skip to content

IssuesService.Edit cannot clear an issue's milestone #236

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
tchap opened this issue Sep 22, 2015 · 15 comments · Fixed by #2195
Closed

IssuesService.Edit cannot clear an issue's milestone #236

tchap opened this issue Sep 22, 2015 · 15 comments · Fixed by #2195

Comments

@tchap
Copy link
Contributor

tchap commented Sep 22, 2015

Much like #181 I fail to see how to use go-github to clear an issue's milestone. The API requires the milestone be to set to null in the request so that it is cleared, but that is not possible since the field uses omitempty.

Not sure what the right solution would be, perhaps a standalone method for clearing milestones?

@tbruyelle
Copy link
Contributor

Is there a workaround for this ?
If no I think a dedicated method is the way to go, something like RemoveMilestonelForIssue, I can work on this.

@tchap
Copy link
Contributor Author

tchap commented May 20, 2016

The workaround is to send the request manually. You can basically copy EditMilestone and put your own struct there.

@tbruyelle
Copy link
Contributor

Indeed, we can workaround it like that (tested) :

       u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, issue)
       req, err := githubCli.NewRequest("PATCH", u, &struct {
               Milestone interface{} `json:"milestone"`
       }{})
       if err != nil {
               return err
       }
       _, err = githubCli.Do(req, nil)
       if err != nil {
               return err
       }

@elliott-beach
Copy link
Contributor

elliott-beach commented Sep 3, 2017

I'm surprised this hasn't been addressed in 2 years, though it's clear it's a problem as @marun has mentioned above. Should we add a removeMilestone method to the IssuesService?

Dropping omitempty is not really an option as there is no distinction between an absent field and a null field in a struct. Another option would be adding a boolean removeMilestone parameter to IssuesService.Edit, but would be a breaking change and make the API awkward to use.

@dmitshur
Copy link
Member

dmitshur commented Sep 5, 2017

I think that's the case because the GitHub API is very large, and removing a milestone from an issue is something only a few people ever need. It has a well described workaround here, so those who need it use that and move on.

To resolve the issue, we need to come up with a good API/good way of doing so.

@alexellis
Copy link
Contributor

Nice to see @elliott-beach again - this issue manifests as a bug with much head scratching and wasted time. Perhaps now that there are multiple consumers with this specific issue, we could fix this issue using this library. What are your thoughts 3 years on?

Alex

@gmlewis
Copy link
Collaborator

gmlewis commented Aug 6, 2021

It seems to me to be a relatively simple matter to resolve this issue by creating a new RemoveMilestone method with the workaround above.

Leaving this issue open.

This would be a great PR for any new contributor to this repo or a new Go developer.
All contributions are greatly appreciated!

Feel free to volunteer for any issue and the issue can be assigned to you so that others don't attempt to duplicate the work.

Please check out our CONTRIBUTING.md guide to get started. (In particular, please remember to go generate ./... and don't use force-push to your PRs.)

Thank you!

@sagar23sj
Copy link
Contributor

Hi @gmlewis, i would like to this work on this issue.
Thanks

@gmlewis
Copy link
Collaborator

gmlewis commented Sep 1, 2021

Hi @gmlewis, i would like to this work on this issue.

Thank you, @sagar23sj, it is yours.

@AGMETEOR
Copy link
Contributor

Hi @sagar23sj , in case you're busy I would like to take this off your plate :)

@AGMETEOR
Copy link
Contributor

Hi @gmlewis , I would like to pick this one up in case @sagar23sj is ok with that :)

@gmlewis
Copy link
Collaborator

gmlewis commented Oct 19, 2021

Thank you, @AGMETEOR - since we haven't heard back from @sagar23sj , I'll assign it to you.

@gmlewis gmlewis assigned AGMETEOR and unassigned sagar23sj Oct 19, 2021
@sagar23sj
Copy link
Contributor

Hi @AGMETEOR, you can take this up.
apologies for not being able to respond

@AGMETEOR
Copy link
Contributor

Thanks @sagar23sj for letting me take this up. I'll start work on it over the weekend when I get some personal time.

@AGMETEOR
Copy link
Contributor

AGMETEOR commented Nov 2, 2021

Still on it...

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

Successfully merging a pull request may close this issue.

8 participants