Skip to content

Commit 100c362

Browse files
authored
Merge pull request #784 from jacobcalvert/jacobcalvert/fix-annotation-serialization-issue
Fix annotation serialization issue
2 parents dc3ec42 + c6a06ee commit 100c362

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

cyclonedx-bom/src/specs/common/snapshots/cyclonedx_bom__specs__common__bom__v1_5__test__it_should_serialize_a_complex_example_to_json.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: cyclonedx-bom/src/specs/common/bom.rs
3-
assertion_line: 654
43
expression: actual
54
---
65
{
@@ -851,7 +850,7 @@ expression: actual
851850
},
852851
"annotations": [
853852
{
854-
"bomRef": "annotation-1",
853+
"bom-ref": "annotation-1",
855854
"subjects": [
856855
"subject1"
857856
],

cyclonedx-bom/src/specs/v1_5/annotation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl FromXml for Annotations {
114114
#[serde(rename_all = "camelCase")]
115115
pub(crate) struct Annotation {
116116
/// Optional identifier to reference the annotation elsewhere in the Bom.
117-
#[serde(skip_serializing_if = "Option::is_none")]
117+
#[serde(rename = "bom-ref", skip_serializing_if = "Option::is_none")]
118118
bom_ref: Option<String>,
119119
/// A list of BOM references, TODO change to `Subjects`
120120
subjects: Vec<String>,

cyclonedx-bom/tests/spec/snapshots/1.5/it_should_parse_all_of_the_valid_json_specifications@valid-annotation-1.5.json.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ input_file: cyclonedx-bom/tests/spec/1.5/valid-annotation-1.5.json
1818
],
1919
"annotations": [
2020
{
21+
"bom-ref": "annotation-1",
2122
"subjects": [
2223
"component-a"
2324
],
@@ -39,6 +40,7 @@ input_file: cyclonedx-bom/tests/spec/1.5/valid-annotation-1.5.json
3940
"text": "This is a sample annotation made by an organization"
4041
},
4142
{
43+
"bom-ref": "annotation-2",
4244
"subjects": [
4345
"component-a"
4446
],
@@ -53,6 +55,7 @@ input_file: cyclonedx-bom/tests/spec/1.5/valid-annotation-1.5.json
5355
"text": "This is a sample annotation made by a person"
5456
},
5557
{
58+
"bom-ref": "annotation-3",
5659
"subjects": [
5760
"component-a"
5861
],
@@ -67,6 +70,7 @@ input_file: cyclonedx-bom/tests/spec/1.5/valid-annotation-1.5.json
6770
"text": "This is a sample annotation made by a component"
6871
},
6972
{
73+
"bom-ref": "annotation-4",
7074
"subjects": [
7175
"component-a"
7276
],

0 commit comments

Comments
 (0)