@@ -148,11 +148,15 @@ func (s *RepositoriesService) GetEnvironment(ctx context.Context, owner, repo, n
148
148
149
149
// MarshalJSON implements the json.Marshaler interface.
150
150
// As the only way to clear a WaitTimer is to set it to 0, a missing WaitTimer object should default to 0, not null.
151
+ // As the default value for CanAdminBypass is true, a nil value here marshals to true.
151
152
func (c * CreateUpdateEnvironment ) MarshalJSON () ([]byte , error ) {
152
153
type Alias CreateUpdateEnvironment
153
154
if c .WaitTimer == nil {
154
155
c .WaitTimer = Int (0 )
155
156
}
157
+ if c .CanAdminsBypass == nil {
158
+ c .CanAdminsBypass = Bool (true )
159
+ }
156
160
return json .Marshal (& struct {
157
161
* Alias
158
162
}{
@@ -163,13 +167,11 @@ func (c *CreateUpdateEnvironment) MarshalJSON() ([]byte, error) {
163
167
// CreateUpdateEnvironment represents the fields required for the create/update operation
164
168
// following the Create/Update release example.
165
169
// See https://github.com/google/go-github/issues/992 for more information.
166
- // Removed omitempty here for for reviewers and deployment_branch_policy as the API expects null values to clear them.
167
- // WaitTimer is set to 0 by the marshaller when empty.
168
- // The API does not accept a null value for can_admins_bypass, so an empty value here is omitted.
170
+ // Removed omitempty here as the API expects null values for reviewers and deployment_branch_policy to clear them.
169
171
type CreateUpdateEnvironment struct {
170
172
WaitTimer * int `json:"wait_timer"`
171
173
Reviewers []* EnvReviewers `json:"reviewers"`
172
- CanAdminsBypass * bool `json:"can_admins_bypass,omitempty "`
174
+ CanAdminsBypass * bool `json:"can_admins_bypass"`
173
175
DeploymentBranchPolicy * BranchPolicy `json:"deployment_branch_policy"`
174
176
}
175
177
0 commit comments