Skip to content

Commit bcc07a6

Browse files
refactor: Tidy view error messages and comments
Per review, drop the redundant "ProjectV2ViewSortBy: " prefix from the UnmarshalJSON error messages (and wrap err2, the actual string-parse error, in that branch), and remove the "(Required.)" notes from the CreateProjectV2ViewRequest Name and Layout field comments.
1 parent 5044ba0 commit bcc07a6

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎github/projects.go‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -918,25 +918,25 @@ func (s *ProjectV2ViewSortBy) UnmarshalJSON(data []byte) error {
918918
return err
919919
}
920920
if len(tuple) != 2 {
921-
return fmt.Errorf("ProjectV2ViewSortBy: expected a [field_id, direction] tuple, got %v elements", len(tuple))
921+
return fmt.Errorf("expected a [field_id, direction] tuple, got %v elements", len(tuple))
922922
}
923923

924924
var fieldID int64
925925
if err := json.Unmarshal(tuple[0], &fieldID); err != nil {
926926
// The OpenAPI schema allows the field_id to be a string as well.
927927
var str string
928928
if err2 := json.Unmarshal(tuple[0], &str); err2 != nil {
929-
return fmt.Errorf("ProjectV2ViewSortBy: invalid field_id: %w", err)
929+
return fmt.Errorf("invalid field_id: %w", err2)
930930
}
931931
fieldID, err = strconv.ParseInt(str, 10, 64)
932932
if err != nil {
933-
return fmt.Errorf("ProjectV2ViewSortBy: invalid field_id %q: %w", str, err)
933+
return fmt.Errorf("invalid field_id %q: %w", str, err)
934934
}
935935
}
936936

937937
var direction string
938938
if err := json.Unmarshal(tuple[1], &direction); err != nil {
939-
return fmt.Errorf("ProjectV2ViewSortBy: invalid direction: %w", err)
939+
return fmt.Errorf("invalid direction: %w", err)
940940
}
941941

942942
s.FieldID = &fieldID
@@ -951,9 +951,9 @@ func (s ProjectV2ViewSortBy) MarshalJSON() ([]byte, error) {
951951

952952
// CreateProjectV2ViewRequest specifies the parameters to create a project view.
953953
type CreateProjectV2ViewRequest struct {
954-
// Name is the view's display name. (Required.)
954+
// Name is the view's display name.
955955
Name string `json:"name"`
956-
// Layout is the view's layout. One of: table, board, roadmap. (Required.)
956+
// Layout is the view's layout. One of: table, board, roadmap.
957957
Layout string `json:"layout"`
958958
// Filter is an optional query string to filter the items shown in the view.
959959
Filter *string `json:"filter,omitempty"`

0 commit comments

Comments
 (0)