Skip to content

Commit

Permalink
Github API documentation was incorrect, dismissal_restrictions should…
Browse files Browse the repository at this point in the history
… be an empty object if nil. Fixes google#664
  • Loading branch information
Faye Salwin committed Aug 10, 2017
1 parent 057228c commit 65110ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions github/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,14 @@ type PullRequestReviewsEnforcementRequest struct {
}

// MarshalJSON implements the json.Marshaler interface.
// Converts nil value of PullRequestReviewsEnforcementRequest.DismissalRestrictionsRequest to empty array
// Converts nil value of PullRequestReviewsEnforcementRequest.DismissalRestrictionsRequest to empty object
func (req PullRequestReviewsEnforcementRequest) MarshalJSON() ([]byte, error) {
if req.DismissalRestrictionsRequest == nil {
newReq := struct {
R []interface{} `json:"dismissal_restrictions"`
R interface{} `json:"dismissal_restrictions"`
D bool `json:"dismiss_stale_reviews"`
}{
R: []interface{}{},
R: map[string]interface{}{},
D: req.DismissStaleReviews,
}
return json.Marshal(newReq)
Expand Down

0 comments on commit 65110ef

Please sign in to comment.