File tree Expand file tree Collapse file tree 3 files changed +507
-502
lines changed
tests/fixtures/nixtract/success Expand file tree Collapse file tree 3 files changed +507
-502
lines changed Original file line number Diff line number Diff line change 1
1
//! This module contains Genealogos' internal representation of incomming data.
2
2
//! Since the initial target of Genealogos is CycloneDX, this model is largely based on their representation.
3
+ use std:: collections:: HashSet ;
4
+
3
5
use serde_cyclonedx:: cyclonedx:: v_1_5 as cyclonedx;
4
6
5
7
#[ derive( Debug ) ]
@@ -51,7 +53,7 @@ pub(crate) struct ModelLicense {
51
53
#[ derive( Debug ) ]
52
54
pub ( crate ) struct ModelDependency {
53
55
pub ( crate ) r#ref : String ,
54
- pub ( crate ) depends_on : Vec < String > ,
56
+ pub ( crate ) depends_on : HashSet < String > ,
55
57
}
56
58
57
59
impl From < ModelType > for String {
Original file line number Diff line number Diff line change @@ -133,9 +133,12 @@ impl From<Nixtract> for Model {
133
133
134
134
impl From < & NixtractLicense > for ModelLicense {
135
135
fn from ( nixtract_license : & NixtractLicense ) -> Self {
136
- ModelLicense {
137
- id : nixtract_license. spdx_id . clone ( ) ,
138
- name : Some ( nixtract_license. full_name . clone ( ) ) ,
139
- }
136
+ let id = nixtract_license. spdx_id . clone ( ) ;
137
+ let name = if id. is_some ( ) {
138
+ None
139
+ } else {
140
+ Some ( nixtract_license. full_name . clone ( ) )
141
+ } ;
142
+ ModelLicense { id, name }
140
143
}
141
144
}
You can’t perform that action at this time.
0 commit comments