Skip to content

Commit

Permalink
make validate() choose the correct SpecVersion to use from the bom sp…
Browse files Browse the repository at this point in the history
…ec_version field

Signed-off-by: m-brophy <mbrophy@redhat.com>
  • Loading branch information
m-brophy committed Nov 6, 2024
1 parent d89acc8 commit 5107bc0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cyclonedx-bom/src/models/bom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ impl Validate for Bom {

context.into()
}

fn validate(&self) -> ValidationResult {
return self.validate_version(self.spec_version);
}
}

#[derive(Default)]
Expand Down Expand Up @@ -717,7 +721,7 @@ mod test {
fn it_should_validate_broken_composition_refs_as_failed() {
let bom = Bom {
version: 1,
spec_version: SpecVersion::V1_3,
spec_version: SpecVersion::V1_5,
serial_number: None,
metadata: None,
components: None,
Expand Down Expand Up @@ -947,7 +951,7 @@ mod test {

let validation_result = Bom {
version: 1,
spec_version: SpecVersion::V1_3,
spec_version: SpecVersion::V1_4,
serial_number: None,
metadata: Some(Metadata {
timestamp: None,
Expand Down

0 comments on commit 5107bc0

Please sign in to comment.