Skip to content

Commit 147a941

Browse files
authored
Merge pull request #644 from justahero/move-types-to-common
Move types to common
2 parents 99156be + 39f9910 commit 147a941

File tree

10 files changed

+37
-30
lines changed

10 files changed

+37
-30
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
1+
/*
2+
* This file is part of CycloneDX Rust Cargo.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
*/
18+
19+
pub(crate) mod advisory;
120
pub(crate) mod attached_text;
221
pub(crate) mod code;
322
pub(crate) mod dependency;
423
pub(crate) mod external_reference;
524
pub(crate) mod hash;
625
pub(crate) mod organization;
726
pub(crate) mod property;
27+
pub(crate) mod signature;
828
pub(crate) mod tool;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
source: cyclonedx-bom/src/specs/v1_4/advisory.rs
3-
assertion_line: 219
2+
source: cyclonedx-bom/src/specs/common/advisory.rs
3+
assertion_line: 215
44
expression: xml_output
55
---
66
<?xml version="1.0" encoding="utf-8"?>

cyclonedx-bom/src/specs/v1_4/bom.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ use crate::{
2828
use crate::{
2929
specs::common::{
3030
dependency::Dependencies, external_reference::ExternalReferences, property::Properties,
31+
signature::Signature,
3132
},
3233
specs::v1_4::{
3334
component::Components, composition::Compositions, metadata::Metadata, service::Services,
34-
signature::Signature, vulnerability::Vulnerabilities,
35+
vulnerability::Vulnerabilities,
3536
},
3637
xml::ToXml,
3738
};
@@ -378,13 +379,13 @@ pub(crate) mod test {
378379
corresponding_external_references, example_external_references,
379380
},
380381
property::test::{corresponding_properties, example_properties},
382+
signature::test::{corresponding_signature, example_signature},
381383
},
382384
specs::v1_4::{
383385
component::test::{corresponding_components, example_components},
384386
composition::test::{corresponding_compositions, example_compositions},
385387
metadata::test::{corresponding_metadata, example_metadata},
386388
service::test::{corresponding_services, example_services},
387-
signature::test::{corresponding_signature, example_signature},
388389
},
389390
xml::test::{read_document_from_string, write_element_to_string},
390391
};

cyclonedx-bom/src/specs/v1_4/component.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use crate::{
2525
specs::common::{
2626
attached_text::AttachedText, code::Commits, code::Patches,
2727
external_reference::ExternalReferences, hash::Hashes, organization::OrganizationalEntity,
28-
property::Properties,
28+
property::Properties, signature::Signature,
2929
},
3030
specs::v1_4::license::Licenses,
3131
xml::{
@@ -42,8 +42,6 @@ use crate::{
4242
use serde::{Deserialize, Serialize};
4343
use xml::{reader, writer::XmlEvent};
4444

45-
use super::signature::Signature;
46-
4745
#[derive(Debug, Deserialize, Serialize, PartialEq)]
4846
#[serde(transparent)]
4947
pub(crate) struct Components(Vec<Component>);
@@ -1209,11 +1207,9 @@ pub(crate) mod test {
12091207
hash::test::{corresponding_hashes, example_hashes},
12101208
organization::test::{corresponding_entity, example_entity},
12111209
property::test::{corresponding_properties, example_properties},
1212-
},
1213-
specs::v1_4::{
1214-
license::test::{corresponding_licenses, example_licenses},
12151210
signature::test::{corresponding_signature, example_signature},
12161211
},
1212+
specs::v1_4::license::test::{corresponding_licenses, example_licenses},
12171213
xml::test::{read_element_from_string, write_element_to_string},
12181214
};
12191215

cyclonedx-bom/src/specs/v1_4/composition.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use crate::{
2020
errors::XmlReadError,
2121
models,
22+
specs::common::signature::Signature,
2223
utilities::{convert_optional, convert_optional_vec, convert_vec},
2324
xml::{
2425
attribute_or_error, closing_tag_or_error, read_lax_validation_list_tag, read_simple_tag,
@@ -29,8 +30,6 @@ use crate::{
2930
use serde::{Deserialize, Serialize};
3031
use xml::{reader, writer::XmlEvent};
3132

32-
use super::signature::Signature;
33-
3433
#[derive(Debug, Deserialize, Serialize, PartialEq)]
3534
#[serde(transparent)]
3635
pub(crate) struct Compositions(Vec<Composition>);
@@ -302,10 +301,8 @@ impl FromXml for BomReference {
302301

303302
#[cfg(test)]
304303
pub(crate) mod test {
305-
use crate::{
306-
specs::v1_4::signature::test::{corresponding_signature, example_signature},
307-
xml::test::{read_element_from_string, write_element_to_string},
308-
};
304+
use crate::specs::common::signature::test::{corresponding_signature, example_signature};
305+
use crate::xml::test::{read_element_from_string, write_element_to_string};
309306

310307
use super::*;
311308

cyclonedx-bom/src/specs/v1_4/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@
1616
* SPDX-License-Identifier: Apache-2.0
1717
*/
1818

19-
pub(crate) mod advisory;
2019
pub(crate) mod bom;
2120
pub(crate) mod component;
2221
pub(crate) mod composition;
2322
pub(crate) mod license;
2423
pub(crate) mod metadata;
2524
pub(crate) mod service;
26-
pub(crate) mod signature;
2725
pub(crate) mod vulnerability;
2826
pub(crate) mod vulnerability_analysis;
2927
pub(crate) mod vulnerability_credits;

cyclonedx-bom/src/specs/v1_4/service.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@ use xml::{reader, writer::XmlEvent};
3232

3333
use crate::specs::common::{
3434
external_reference::ExternalReferences, organization::OrganizationalEntity,
35-
property::Properties,
35+
property::Properties, signature::Signature,
3636
};
3737
use crate::specs::v1_4::license::Licenses;
3838

39-
use super::signature::Signature;
40-
4139
#[derive(Debug, Deserialize, Serialize, PartialEq)]
4240
#[serde(transparent)]
4341
pub(crate) struct Services(Vec<Service>);
@@ -530,11 +528,9 @@ pub(crate) mod test {
530528
},
531529
organization::test::{corresponding_entity, example_entity},
532530
property::test::{corresponding_properties, example_properties},
533-
},
534-
specs::v1_4::{
535-
license::test::{corresponding_licenses, example_licenses},
536531
signature::test::{corresponding_signature, example_signature},
537532
},
533+
specs::v1_4::license::test::{corresponding_licenses, example_licenses},
538534
xml::test::{read_element_from_string, write_element_to_string},
539535
};
540536

cyclonedx-bom/src/specs/v1_4/vulnerability.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ use crate::{
3030
use serde::{Deserialize, Serialize};
3131
use xml::{reader, writer::XmlEvent};
3232

33-
use crate::specs::common::{property::Properties, tool::Tools};
33+
use crate::specs::common::{advisory::Advisories, property::Properties, tool::Tools};
3434
use crate::specs::v1_4::{
35-
advisory::Advisories, vulnerability_analysis::VulnerabilityAnalysis,
36-
vulnerability_credits::VulnerabilityCredits, vulnerability_rating::VulnerabilityRatings,
37-
vulnerability_reference::VulnerabilityReferences, vulnerability_source::VulnerabilitySource,
38-
vulnerability_target::VulnerabilityTargets,
35+
vulnerability_analysis::VulnerabilityAnalysis, vulnerability_credits::VulnerabilityCredits,
36+
vulnerability_rating::VulnerabilityRatings, vulnerability_reference::VulnerabilityReferences,
37+
vulnerability_source::VulnerabilitySource, vulnerability_target::VulnerabilityTargets,
3938
};
4039

4140
#[derive(Debug, Deserialize, Serialize, PartialEq)]
@@ -499,11 +498,11 @@ pub(crate) mod test {
499498
use super::*;
500499
use crate::{
501500
specs::common::{
501+
advisory::test::{corresponding_advisories, example_advisories},
502502
property::test::{corresponding_properties, example_properties},
503503
tool::test::{corresponding_tools, example_tools},
504504
},
505505
specs::v1_4::{
506-
advisory::test::{corresponding_advisories, example_advisories},
507506
vulnerability_analysis::test::{
508507
corresponding_vulnerability_analysis, example_vulnerability_analysis,
509508
},

0 commit comments

Comments
 (0)