Skip to content

Commit a5eca73

Browse files
authored
fix!: Align IssueFieldValues with schema (#4207)
BREAKING CHANGE: `IssueRequest.IssueFieldValues` type is changed.
1 parent 953382f commit a5eca73

3 files changed

Lines changed: 80 additions & 58 deletions

File tree

github/github-accessors.go

Lines changed: 35 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 23 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/issues.go

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ type IssueRequest struct {
9595
Assignee *string `json:"assignee,omitempty"`
9696
State *string `json:"state,omitempty"`
9797
// StateReason can be 'completed' or 'not_planned'.
98-
StateReason *string `json:"state_reason,omitempty"`
99-
Milestone *int `json:"milestone,omitempty"`
100-
Assignees *[]string `json:"assignees,omitempty"`
101-
Type *string `json:"type,omitempty"`
102-
IssueFieldValues []*IssueFieldValue `json:"issue_field_values,omitempty"`
98+
StateReason *string `json:"state_reason,omitempty"`
99+
Milestone *int `json:"milestone,omitempty"`
100+
Assignees *[]string `json:"assignees,omitempty"`
101+
Type *string `json:"type,omitempty"`
102+
IssueFieldValues []*IssueRequestFieldValue `json:"issue_field_values,omitempty"`
103103
}
104104

105105
// PullRequestLinks object is added to the Issue object when it's an issue included
@@ -126,23 +126,31 @@ type IssueType struct {
126126

127127
// IssueFieldValueSingleSelectOption represents a single-select option for an issue field value.
128128
//
129-
// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue
129+
// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue
130130
type IssueFieldValueSingleSelectOption struct {
131-
ID *int64 `json:"id,omitempty"`
132-
Name *string `json:"name,omitempty"`
133-
Color *string `json:"color,omitempty"`
131+
ID int64 `json:"id"`
132+
Name string `json:"name"`
133+
Color string `json:"color"`
134+
}
135+
136+
// IssueRequestFieldValue represents a custom field value to set on an issue.
137+
//
138+
// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#update-an-issue
139+
type IssueRequestFieldValue struct {
140+
FieldID int64 `json:"field_id"`
141+
Value any `json:"value"`
134142
}
135143

136144
// IssueFieldValue represents a custom field value attached to an issue.
137145
// The Value field contains a string for text, single_select, and date fields,
138146
// or a number for numeric fields.
139147
//
140-
// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue
148+
// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue
141149
type IssueFieldValue struct {
142-
IssueFieldID *int64 `json:"issue_field_id,omitempty"`
143-
NodeID *string `json:"node_id,omitempty"`
144-
DataType *string `json:"data_type,omitempty"`
145-
Value any `json:"value,omitempty"`
150+
IssueFieldID int64 `json:"issue_field_id"`
151+
NodeID string `json:"node_id"`
152+
DataType string `json:"data_type"`
153+
Value any `json:"value"`
146154
SingleSelectOption *IssueFieldValueSingleSelectOption `json:"single_select_option,omitempty"`
147155
}
148156

0 commit comments

Comments
 (0)