Skip to content

Commit

Permalink
Merge pull request #12 from tweag/spec-compliancy
Browse files Browse the repository at this point in the history
Spec compliancy
  • Loading branch information
Erin van der Veen authored Jan 12, 2024
2 parents 251b879 + 19cf6bc commit 2f16422
Show file tree
Hide file tree
Showing 3 changed files with 507 additions and 502 deletions.
4 changes: 3 additions & 1 deletion src/model.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! This module contains Genealogos' internal representation of incomming data.
//! Since the initial target of Genealogos is CycloneDX, this model is largely based on their representation.
use std::collections::HashSet;

use serde_cyclonedx::cyclonedx::v_1_5 as cyclonedx;

#[derive(Debug)]
Expand Down Expand Up @@ -51,7 +53,7 @@ pub(crate) struct ModelLicense {
#[derive(Debug)]
pub(crate) struct ModelDependency {
pub(crate) r#ref: String,
pub(crate) depends_on: Vec<String>,
pub(crate) depends_on: HashSet<String>,
}

impl From<ModelType> for String {
Expand Down
11 changes: 7 additions & 4 deletions src/nixtract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,12 @@ impl From<Nixtract> for Model {

impl From<&NixtractLicense> for ModelLicense {
fn from(nixtract_license: &NixtractLicense) -> Self {
ModelLicense {
id: nixtract_license.spdx_id.clone(),
name: Some(nixtract_license.full_name.clone()),
}
let id = nixtract_license.spdx_id.clone();
let name = if id.is_some() {
None
} else {
Some(nixtract_license.full_name.clone())
};
ModelLicense { id, name }
}
}
Loading

0 comments on commit 2f16422

Please sign in to comment.