Skip to content

Commit ded762e

Browse files
committed
deduplicate external_reference
Signed-off-by: Christian Poveda <[email protected]>
1 parent 5d2203a commit ded762e

13 files changed

+48
-333
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pub(crate) mod attached_text;
22
pub(crate) mod code;
33
pub(crate) mod dependency;
4+
pub(crate) mod external_reference;
45
pub(crate) mod hash;
56
pub(crate) mod organization;
67
pub(crate) mod property;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
source: cyclonedx-bom/src/specs/v1_4/external_reference.rs
2+
source: cyclonedx-bom/src/specs/common/external_reference.rs
33
expression: xml_output
44
---
55
<?xml version="1.0" encoding="utf-8"?>

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ use crate::{
2828
},
2929
};
3030
use crate::{
31-
specs::common::{dependency::Dependencies, property::Properties},
31+
specs::common::{
32+
dependency::Dependencies, external_reference::ExternalReferences, property::Properties,
33+
},
3234
specs::v1_3::{
33-
component::Components, composition::Compositions, external_reference::ExternalReferences,
34-
metadata::Metadata, service::Services,
35+
component::Components, composition::Compositions, metadata::Metadata, service::Services,
3536
},
3637
xml::ToXml,
3738
};
@@ -339,14 +340,14 @@ pub(crate) mod test {
339340
use crate::{
340341
specs::common::{
341342
dependency::test::{corresponding_dependencies, example_dependencies},
343+
external_reference::test::{
344+
corresponding_external_references, example_external_references,
345+
},
342346
property::test::{corresponding_properties, example_properties},
343347
},
344348
specs::v1_3::{
345349
component::test::{corresponding_components, example_components},
346350
composition::test::{corresponding_compositions, example_compositions},
347-
external_reference::test::{
348-
corresponding_external_references, example_external_references,
349-
},
350351
metadata::test::{corresponding_metadata, example_metadata},
351352
service::test::{corresponding_services, example_services},
352353
},

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ use crate::{
2828
uri::{Purl, Uri},
2929
},
3030
specs::common::{
31-
attached_text::AttachedText, code::Commits, code::Patches, hash::Hashes,
32-
organization::OrganizationalEntity, property::Properties,
31+
attached_text::AttachedText, code::Commits, code::Patches,
32+
external_reference::ExternalReferences, hash::Hashes, organization::OrganizationalEntity,
33+
property::Properties,
3334
},
34-
specs::v1_3::{external_reference::ExternalReferences, license::Licenses},
35+
specs::v1_3::license::Licenses,
3536
xml::{
3637
attribute_or_error, optional_attribute, read_boolean_tag, read_lax_validation_list_tag,
3738
read_lax_validation_tag, read_list_tag, read_simple_tag, to_xml_read_error,
@@ -1181,16 +1182,14 @@ pub(crate) mod test {
11811182
code::test::{
11821183
corresponding_commits, corresponding_patches, example_commits, example_patches,
11831184
},
1184-
hash::test::{corresponding_hashes, example_hashes},
1185-
organization::test::{corresponding_entity, example_entity},
1186-
property::test::{corresponding_properties, example_properties},
1187-
},
1188-
specs::v1_3::{
11891185
external_reference::test::{
11901186
corresponding_external_references, example_external_references,
11911187
},
1192-
license::test::{corresponding_licenses, example_licenses},
1188+
hash::test::{corresponding_hashes, example_hashes},
1189+
organization::test::{corresponding_entity, example_entity},
1190+
property::test::{corresponding_properties, example_properties},
11931191
},
1192+
specs::v1_3::license::test::{corresponding_licenses, example_licenses},
11941193
xml::test::{read_element_from_string, write_element_to_string},
11951194
};
11961195

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
pub(crate) mod bom;
2020
pub(crate) mod component;
2121
pub(crate) mod composition;
22-
pub(crate) mod external_reference;
2322
pub(crate) mod license;
2423
pub(crate) mod metadata;
2524
pub(crate) mod service;

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

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

33-
use crate::specs::common::{organization::OrganizationalEntity, property::Properties};
34-
use crate::specs::v1_3::{external_reference::ExternalReferences, license::Licenses};
33+
use crate::specs::common::{
34+
external_reference::ExternalReferences, organization::OrganizationalEntity,
35+
property::Properties,
36+
};
37+
use crate::specs::v1_3::license::Licenses;
3538

3639
#[derive(Debug, Deserialize, Serialize, PartialEq)]
3740
#[serde(transparent)]
@@ -486,15 +489,13 @@ pub(crate) mod test {
486489
use super::*;
487490
use crate::{
488491
specs::common::{
489-
organization::test::{corresponding_entity, example_entity},
490-
property::test::{corresponding_properties, example_properties},
491-
},
492-
specs::v1_3::{
493492
external_reference::test::{
494493
corresponding_external_references, example_external_references,
495494
},
496-
license::test::{corresponding_licenses, example_licenses},
495+
organization::test::{corresponding_entity, example_entity},
496+
property::test::{corresponding_properties, example_properties},
497497
},
498+
specs::v1_3::license::test::{corresponding_licenses, example_licenses},
498499
xml::test::{read_element_from_string, write_element_to_string},
499500
};
500501

cyclonedx-bom/src/specs/v1_3/snapshots/cyclonedx_bom__specs__v1_3__external_reference__test__it_should_write_xml_full.snap

Lines changed: 0 additions & 16 deletions
This file was deleted.

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ use crate::{
2626
},
2727
};
2828
use crate::{
29-
specs::common::{dependency::Dependencies, property::Properties},
29+
specs::common::{
30+
dependency::Dependencies, external_reference::ExternalReferences, property::Properties,
31+
},
3032
specs::v1_4::{
31-
component::Components, composition::Compositions, external_reference::ExternalReferences,
32-
metadata::Metadata, service::Services, signature::Signature,
33-
vulnerability::Vulnerabilities,
33+
component::Components, composition::Compositions, metadata::Metadata, service::Services,
34+
signature::Signature, vulnerability::Vulnerabilities,
3435
},
3536
xml::ToXml,
3637
};
@@ -373,14 +374,14 @@ pub(crate) mod test {
373374
use crate::{
374375
specs::common::{
375376
dependency::test::{corresponding_dependencies, example_dependencies},
377+
external_reference::test::{
378+
corresponding_external_references, example_external_references,
379+
},
376380
property::test::{corresponding_properties, example_properties},
377381
},
378382
specs::v1_4::{
379383
component::test::{corresponding_components, example_components},
380384
composition::test::{corresponding_compositions, example_compositions},
381-
external_reference::test::{
382-
corresponding_external_references, example_external_references,
383-
},
384385
metadata::test::{corresponding_metadata, example_metadata},
385386
service::test::{corresponding_services, example_services},
386387
signature::test::{corresponding_signature, example_signature},

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ use crate::{
2323
uri::{Purl, Uri},
2424
},
2525
specs::common::{
26-
attached_text::AttachedText, code::Commits, code::Patches, hash::Hashes,
27-
organization::OrganizationalEntity, property::Properties,
26+
attached_text::AttachedText, code::Commits, code::Patches,
27+
external_reference::ExternalReferences, hash::Hashes, organization::OrganizationalEntity,
28+
property::Properties,
2829
},
29-
specs::v1_4::{external_reference::ExternalReferences, license::Licenses},
30+
specs::v1_4::license::Licenses,
3031
xml::{
3132
attribute_or_error, optional_attribute, read_boolean_tag, read_lax_validation_list_tag,
3233
read_lax_validation_tag, read_list_tag, read_simple_tag, to_xml_read_error,
@@ -1202,14 +1203,14 @@ pub(crate) mod test {
12021203
code::test::{
12031204
corresponding_commits, corresponding_patches, example_commits, example_patches,
12041205
},
1206+
external_reference::test::{
1207+
corresponding_external_references, example_external_references,
1208+
},
12051209
hash::test::{corresponding_hashes, example_hashes},
12061210
organization::test::{corresponding_entity, example_entity},
12071211
property::test::{corresponding_properties, example_properties},
12081212
},
12091213
specs::v1_4::{
1210-
external_reference::test::{
1211-
corresponding_external_references, example_external_references,
1212-
},
12131214
license::test::{corresponding_licenses, example_licenses},
12141215
signature::test::{corresponding_signature, example_signature},
12151216
},

0 commit comments

Comments
 (0)