Skip to content

Fix annotation serialization issue #784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: cyclonedx-bom/src/specs/common/bom.rs
assertion_line: 654
expression: actual
---
{
Expand Down Expand Up @@ -851,7 +850,7 @@ expression: actual
},
"annotations": [
{
"bomRef": "annotation-1",
"bom-ref": "annotation-1",
"subjects": [
"subject1"
],
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx-bom/src/specs/v1_5/annotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl FromXml for Annotations {
#[serde(rename_all = "camelCase")]
pub(crate) struct Annotation {
/// Optional identifier to reference the annotation elsewhere in the Bom.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "bom-ref", skip_serializing_if = "Option::is_none")]
bom_ref: Option<String>,
/// A list of BOM references, TODO change to `Subjects`
subjects: Vec<String>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ input_file: cyclonedx-bom/tests/spec/1.5/valid-annotation-1.5.json
],
"annotations": [
{
"bom-ref": "annotation-1",
"subjects": [
"component-a"
],
Expand All @@ -39,6 +40,7 @@ input_file: cyclonedx-bom/tests/spec/1.5/valid-annotation-1.5.json
"text": "This is a sample annotation made by an organization"
},
{
"bom-ref": "annotation-2",
"subjects": [
"component-a"
],
Expand All @@ -53,6 +55,7 @@ input_file: cyclonedx-bom/tests/spec/1.5/valid-annotation-1.5.json
"text": "This is a sample annotation made by a person"
},
{
"bom-ref": "annotation-3",
"subjects": [
"component-a"
],
Expand All @@ -67,6 +70,7 @@ input_file: cyclonedx-bom/tests/spec/1.5/valid-annotation-1.5.json
"text": "This is a sample annotation made by a component"
},
{
"bom-ref": "annotation-4",
"subjects": [
"component-a"
],
Expand Down
Loading