Skip to content

Commit 762f17d

Browse files
committed
schema: Support References without type
There are some examples in the OSV database which have untyped references. Currently these fail to parse. For example: https://www.googleapis.com/download/storage/v1/b/osv-vulnerabilities/o/Debian%2FCVE-2018-11212.json?generation=1758701673567991&alt=media
1 parent 199fc84 commit 762f17d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/schema.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ pub struct Affected {
395395
/// The type of reference information that has been provided. Examples include
396396
/// links to the original report, external advisories, or information about the
397397
/// fix.
398-
#[derive(Clone, Debug, Serialize, Deserialize)]
398+
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
399399
#[serde(rename_all = "UPPERCASE")]
400400
#[non_exhaustive]
401401
pub enum ReferenceType {
@@ -430,6 +430,7 @@ pub enum ReferenceType {
430430
/// A report, typically on a bug or issue tracker, of the vulnerability.
431431
Report,
432432

433+
#[default]
433434
#[serde(rename = "NONE")]
434435
Undefined,
435436

@@ -441,7 +442,7 @@ pub enum ReferenceType {
441442
#[derive(Clone, Debug, Serialize, Deserialize)]
442443
pub struct Reference {
443444
/// The type of reference this URL points to.
444-
#[serde(rename = "type")]
445+
#[serde(rename = "type", default)]
445446
pub reference_type: ReferenceType,
446447

447448
/// The url where more information can be obtained about

0 commit comments

Comments
 (0)