@@ -295,7 +295,7 @@ impl<'de> Deserialize<'de> for Ecosystem {
295295 "SwiftURL" => Ok ( Ecosystem :: SwiftURL ) ,
296296 _ if value. starts_with ( "Ubuntu:" ) => {
297297 regex_switch ! ( value,
298- r#"^Ubuntu(?::Pro)?(?::(?<fips>FIPS(?:-preview|-updates)?))?:(?<version>\d+\.\d+)(?::LTS)?(?::for:(?<specialized>.+))?$ "# => {
298+ r#"^Ubuntu(?::Pro)?(?::(?<fips>FIPS(?:-preview|-updates)?))?:(?<version>\d+\.\d+)(?::LTS)?(?::for:(?<specialized>.+))?"# => {
299299 Ecosystem :: Ubuntu {
300300 version: version. to_string( ) ,
301301 metadata: ( !specialized. is_empty( ) ) . then_some( specialized. to_string( ) ) ,
@@ -422,7 +422,7 @@ pub struct Affected {
422422/// The type of reference information that has been provided. Examples include
423423/// links to the original report, external advisories, or information about the
424424/// fix.
425- #[ derive( Clone , Debug , Serialize , Deserialize ) ]
425+ #[ derive( Clone , Debug , Default , Serialize , Deserialize ) ]
426426#[ serde( rename_all = "UPPERCASE" ) ]
427427#[ non_exhaustive]
428428pub enum ReferenceType {
@@ -457,6 +457,7 @@ pub enum ReferenceType {
457457 /// A report, typically on a bug or issue tracker, of the vulnerability.
458458 Report ,
459459
460+ #[ default]
460461 #[ serde( rename = "NONE" ) ]
461462 Undefined ,
462463
@@ -468,7 +469,7 @@ pub enum ReferenceType {
468469#[ derive( Clone , Debug , Serialize , Deserialize ) ]
469470pub struct Reference {
470471 /// The type of reference this URL points to.
471- #[ serde( rename = "type" ) ]
472+ #[ serde( rename = "type" , default ) ]
472473 pub reference_type : ReferenceType ,
473474
474475 /// The url where more information can be obtained about
@@ -478,7 +479,7 @@ pub struct Reference {
478479
479480/// The [`SeverityType`](SeverityType) describes the quantitative scoring method used to rate the
480481/// severity of the vulnerability.
481- #[ derive( Clone , Debug , Serialize , Deserialize ) ]
482+ #[ derive( Clone , Debug , Serialize , Deserialize , Default ) ]
482483#[ non_exhaustive]
483484pub enum SeverityType {
484485 /// A CVSS vector string representing the unique characteristics and severity of the vulnerability
@@ -506,6 +507,7 @@ pub enum SeverityType {
506507
507508 /// The severity score was arrived at by using an unspecified
508509 /// scoring method.
510+ #[ default]
509511 #[ serde( rename = "UNSPECIFIED" ) ]
510512 Unspecified ,
511513}
@@ -516,7 +518,7 @@ pub enum SeverityType {
516518pub struct Severity {
517519 /// The severity type property must be a [`SeverityType`](SeverityType), which describes the
518520 /// quantitative method used to calculate the associated score.
519- #[ serde( rename = "type" ) ]
521+ #[ serde( rename = "type" , default ) ]
520522 pub severity_type : SeverityType ,
521523
522524 /// The score property is a string representing the severity score based on the
@@ -769,6 +771,19 @@ mod tests {
769771 let json_str = r#""Ubuntu:20.04""# ;
770772 check_ser_deser ( ubuntu, json_str) ;
771773
774+ let json_str = r#""Ubuntu:Pro:24.04:LTS:Realtime:Kernel""# ;
775+ let ubuntu: Ecosystem = serde_json:: from_str ( json_str) . unwrap ( ) ;
776+ assert_eq ! (
777+ ubuntu,
778+ Ecosystem :: Ubuntu {
779+ version: "24.04" . to_string( ) ,
780+ pro: true ,
781+ lts: true ,
782+ fips: None ,
783+ metadata: None ,
784+ }
785+ ) ;
786+
772787 let ubuntu = Ecosystem :: Ubuntu {
773788 version : "22.04" . to_string ( ) ,
774789 pro : false ,
0 commit comments