Skip to content

Commit 2f16422

Browse files
author
Erin van der Veen
authored
Merge pull request #12 from tweag/spec-compliancy
Spec compliancy
2 parents 251b879 + 19cf6bc commit 2f16422

File tree

3 files changed

+507
-502
lines changed

3 files changed

+507
-502
lines changed

src/model.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! This module contains Genealogos' internal representation of incomming data.
22
//! Since the initial target of Genealogos is CycloneDX, this model is largely based on their representation.
3+
use std::collections::HashSet;
4+
35
use serde_cyclonedx::cyclonedx::v_1_5 as cyclonedx;
46

57
#[derive(Debug)]
@@ -51,7 +53,7 @@ pub(crate) struct ModelLicense {
5153
#[derive(Debug)]
5254
pub(crate) struct ModelDependency {
5355
pub(crate) r#ref: String,
54-
pub(crate) depends_on: Vec<String>,
56+
pub(crate) depends_on: HashSet<String>,
5557
}
5658

5759
impl From<ModelType> for String {

src/nixtract.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,12 @@ impl From<Nixtract> for Model {
133133

134134
impl From<&NixtractLicense> for ModelLicense {
135135
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 }
140143
}
141144
}

0 commit comments

Comments
 (0)