Removing weight from an issue
I'm trying to use the client to remove a weight from an issue. It is possible to do this directly through the REST API:
curl --request PUT \
--header "PRIVATE-TOKEN: <your_access_token>" \
--header "Content-Type: application/json" \
--data '{"weight": null}' \
"https://gitlab.com/api/v4/projects/<project_id_or_path>/issues/<issue_iid>"
... however, the client code defines the Weight
as omitempty
so I can never explicitly set it to null
in the JSON encoding. Changing this would probably not be backwards compatible or break update semantics. But I'd like to write an MR to support this somehow. Only I don't directly have an idea on how to write this.
Perhaps we could add an explicit boolean like RemoveWeight
that then magically updates the outgoing JSON request? It feels a bit hacky though.
Weight *int `url:"weight,omitempty" json:"weight,omitempty"`