Skip to content

Commit

Permalink
Fix some issues with the model. (google#312)
Browse files Browse the repository at this point in the history
- add omitempty to more optional fields.
- correct severity, which is an array.

Signed-off-by: Caleb Brown <calebbrown@google.com>
  • Loading branch information
calebbrown committed Mar 23, 2023
1 parent 529788b commit f7fe386
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/models/vulnerability.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ type Severity struct {
// See: https://ossf.github.io/osv-schema/#affected-fields
type Affected struct {
Package Package `json:"package"`
Severity Severity `json:"severity,omitempty"`
Ranges []Range `json:"ranges"`
Severity []Severity `json:"severity,omitempty"`
Ranges []Range `json:"ranges,omitempty"`
Versions []string `json:"versions,omitempty"`
DatabaseSpecific map[string]interface{} `json:"database_specific,omitempty"`
EcosystemSpecific map[string]interface{} `json:"ecosystem_specific,omitempty"`
Expand Down Expand Up @@ -89,11 +89,12 @@ type Vulnerability struct {
ID string `json:"id"`
Modified time.Time `json:"modified"`
Published time.Time `json:"published"`
Aliases []string `json:"aliases"`
Aliases []string `json:"aliases,omitempty"`
Summary string `json:"summary"`
Details string `json:"details"`
Affected []Affected `json:"affected"`
References []Reference `json:"references"`
Credits []Credit `json:"credits"`
Severity []Severity `json:"severity,omitempty"`
References []Reference `json:"references,omitempty"`
Credits []Credit `json:"credits,omitempty"`
DatabaseSpecific map[string]interface{} `json:"database_specific,omitempty"`
}

0 comments on commit f7fe386

Please sign in to comment.