Skip to content

Commit 362c31a

Browse files
refactor: Polish ProjectV2View and SortBy structs
Per review, drop the inconsistent per-field comments from ProjectV2View so the struct matches the sibling ProjectV2 (no per-field comments), and add an explicit json:"-" tag to ProjectV2ViewSortBy's FieldID and Direction fields, which are (de)serialized through custom MarshalJSON / UnmarshalJSON rather than struct tags.
1 parent bcc07a6 commit 362c31a

1 file changed

Lines changed: 17 additions & 21 deletions

File tree

‎github/projects.go‎

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -878,25 +878,21 @@ func (s *ProjectsService) AddUserProjectField(ctx context.Context, username stri
878878

879879
// ProjectV2View represents a view in a project.
880880
type ProjectV2View struct {
881-
ID int64 `json:"id"`
882-
Number int `json:"number"`
883-
Name string `json:"name"`
884-
Layout string `json:"layout"`
885-
NodeID string `json:"node_id"`
886-
ProjectURL string `json:"project_url"`
887-
HTMLURL string `json:"html_url"`
888-
Creator *User `json:"creator,omitempty"`
889-
Filter *string `json:"filter,omitempty"`
890-
// VisibleFields holds the IDs of the fields displayed in the view.
891-
VisibleFields []int64 `json:"visible_fields,omitempty"`
892-
// SortBy holds the view's sorting configuration, in priority order.
893-
SortBy []*ProjectV2ViewSortBy `json:"sort_by,omitempty"`
894-
// GroupBy holds the IDs of the fields the view is grouped by.
895-
GroupBy []int64 `json:"group_by,omitempty"`
896-
// VerticalGroupBy holds the IDs of the fields the view is vertically grouped by.
897-
VerticalGroupBy []int64 `json:"vertical_group_by,omitempty"`
898-
CreatedAt *Timestamp `json:"created_at,omitempty"`
899-
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
881+
ID int64 `json:"id"`
882+
Number int `json:"number"`
883+
Name string `json:"name"`
884+
Layout string `json:"layout"`
885+
NodeID string `json:"node_id"`
886+
ProjectURL string `json:"project_url"`
887+
HTMLURL string `json:"html_url"`
888+
Creator *User `json:"creator,omitempty"`
889+
Filter *string `json:"filter,omitempty"`
890+
VisibleFields []int64 `json:"visible_fields,omitempty"`
891+
SortBy []*ProjectV2ViewSortBy `json:"sort_by,omitempty"`
892+
GroupBy []int64 `json:"group_by,omitempty"`
893+
VerticalGroupBy []int64 `json:"vertical_group_by,omitempty"`
894+
CreatedAt *Timestamp `json:"created_at,omitempty"`
895+
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
900896
}
901897

902898
// ProjectV2ViewSortBy represents a single sort criterion of a project view.
@@ -905,9 +901,9 @@ type ProjectV2View struct {
905901
// object, so it has custom JSON (un)marshaling.
906902
type ProjectV2ViewSortBy struct {
907903
// FieldID is the ID of the field to sort by.
908-
FieldID *int64
904+
FieldID *int64 `json:"-"`
909905
// Direction is the sort direction, one of "asc" or "desc".
910-
Direction *string
906+
Direction *string `json:"-"`
911907
}
912908

913909
// UnmarshalJSON implements custom unmarshaling for the [field_id, direction]

0 commit comments

Comments
 (0)