Skip to content

Commit

Permalink
Fix deprecated state/open field (google#2017)
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshkumarsv authored Aug 6, 2021
1 parent d8a66d0 commit 816c8c6
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 34 deletions.
17 changes: 9 additions & 8 deletions github/code-scanning.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ type CodeScanningService service

// Rule represents the complete details of GitHub Code Scanning alert type.
type Rule struct {
ID *string `json:"id,omitempty"`
Severity *string `json:"severity,omitempty"`
Description *string `json:"description,omitempty"`
Name *string `json:"name,omitempty"`
FullDescription *string `json:"full_description,omitempty"`
Tags []string `json:"tags,omitempty"`
Help *string `json:"help,omitempty"`
ID *string `json:"id,omitempty"`
Severity *string `json:"severity,omitempty"`
Description *string `json:"description,omitempty"`
Name *string `json:"name,omitempty"`
SecuritySeverityLevel *string `json:"security_severity_level,omitempty"`
FullDescription *string `json:"full_description,omitempty"`
Tags []string `json:"tags,omitempty"`
Help *string `json:"help,omitempty"`
}

// Location represents the exact location of the GitHub Code Scanning Alert in the scanned project.
Expand Down Expand Up @@ -72,7 +73,7 @@ type Alert struct {
Rule *Rule `json:"rule,omitempty"`
Tool *Tool `json:"tool,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
Open *bool `json:"open,omitempty"`
State *string `json:"state,omitempty"`
ClosedBy *User `json:"closed_by,omitempty"`
ClosedAt *Timestamp `json:"closed_at,omitempty"`
URL *string `json:"url,omitempty"`
Expand Down
16 changes: 8 additions & 8 deletions github/code-scanning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestActionsService_ListAlertsForRepo(t *testing.T) {
]
},
"created_at":"2020-05-06T12:00:00Z",
"open":true,
"state":"open",
"closed_by":null,
"closed_at":null,
"url":"https://api.github.com/repos/o/r/code-scanning/alerts/25",
Expand Down Expand Up @@ -138,7 +138,7 @@ func TestActionsService_ListAlertsForRepo(t *testing.T) {
]
},
"created_at":"2020-05-06T12:00:00Z",
"open":true,
"state":"open",
"closed_by":null,
"closed_at":null,
"url":"https://api.github.com/repos/o/r/code-scanning/alerts/88",
Expand Down Expand Up @@ -169,7 +169,7 @@ func TestActionsService_ListAlertsForRepo(t *testing.T) {
Help: String("Expression has no effect"),
},
CreatedAt: &date,
Open: Bool(true),
State: String("open"),
ClosedBy: nil,
ClosedAt: nil,
URL: String("https://api.github.com/repos/o/r/code-scanning/alerts/25"),
Expand Down Expand Up @@ -205,7 +205,7 @@ func TestActionsService_ListAlertsForRepo(t *testing.T) {
Help: String("Expression has no effect"),
},
CreatedAt: &date,
Open: Bool(true),
State: String("open"),
ClosedBy: nil,
ClosedAt: nil,
URL: String("https://api.github.com/repos/o/r/code-scanning/alerts/88"),
Expand Down Expand Up @@ -288,7 +288,7 @@ func TestActionsService_GetAlert(t *testing.T) {
]
},
"created_at":"2019-01-02T15:04:05Z",
"open":true,
"state":"open",
"closed_by":null,
"closed_at":null,
"url":"https://api.github.com/repos/o/r/code-scanning/alerts/88",
Expand Down Expand Up @@ -316,7 +316,7 @@ func TestActionsService_GetAlert(t *testing.T) {
Help: String("Expression has no effect"),
},
CreatedAt: &date,
Open: Bool(true),
State: String("open"),
ClosedBy: nil,
ClosedAt: nil,
URL: String("https://api.github.com/repos/o/r/code-scanning/alerts/88"),
Expand Down Expand Up @@ -370,7 +370,7 @@ func TestAlert_Marshal(t *testing.T) {
Version: String("v"),
},
CreatedAt: &Timestamp{referenceTime},
Open: Bool(false),
State: String("fixed"),
ClosedBy: &User{
Login: String("l"),
ID: Int64(1),
Expand All @@ -395,7 +395,7 @@ func TestAlert_Marshal(t *testing.T) {
"version": "v"
},
"created_at": ` + referenceTimeStr + `,
"open": false,
"state": "fixed",
"closed_by": {
"login": "l",
"id": 1,
Expand Down
24 changes: 16 additions & 8 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 20 additions & 10 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 816c8c6

Please sign in to comment.