Skip to content

Commit f9762ba

Browse files
committed
Use response instead of responses when serializing VulnerabilityAnalysis
Signed-off-by: Naxdy <naxdy@naxdy.org>
1 parent d5c35fd commit f9762ba

5 files changed

Lines changed: 18 additions & 12 deletions

cyclonedx-bom/src/specs/common/snapshots/cyclonedx_bom__specs__common__bom__v1_4__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
{
@@ -561,7 +560,7 @@ expression: actual
561560
"analysis": {
562561
"state": "not_affected",
563562
"justification": "code_not_reachable",
564-
"responses": [
563+
"response": [
565564
"update"
566565
],
567566
"detail": "detail"

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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ expression: actual
814814
"analysis": {
815815
"state": "not_affected",
816816
"justification": "code_not_reachable",
817-
"responses": [
817+
"response": [
818818
"update"
819819
],
820820
"detail": "detail",

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub(crate) mod base {
4444
#[serde(skip_serializing_if = "Option::is_none")]
4545
justification: Option<ImpactAnalysisJustification>,
4646
#[serde(skip_serializing_if = "Option::is_none")]
47-
responses: Option<Vec<ImpactAnalysisResponse>>,
47+
response: Option<Vec<ImpactAnalysisResponse>>,
4848
#[serde(skip_serializing_if = "Option::is_none")]
4949
detail: Option<String>,
5050
#[versioned("1.5")]
@@ -60,7 +60,7 @@ pub(crate) mod base {
6060
Self {
6161
state: convert_optional(other.state),
6262
justification: convert_optional(other.justification),
63-
responses: convert_optional_vec(other.responses),
63+
response: convert_optional_vec(other.responses),
6464
detail: other.detail,
6565
#[versioned("1.5")]
6666
first_issued: other.first_issued.map(|d| d.to_string()),
@@ -75,7 +75,7 @@ pub(crate) mod base {
7575
Self {
7676
state: convert_optional(other.state),
7777
justification: convert_optional(other.justification),
78-
responses: convert_optional_vec(other.responses),
78+
responses: convert_optional_vec(other.response),
7979
detail: other.detail,
8080
#[versioned("1.4")]
8181
first_issued: None,
@@ -115,7 +115,7 @@ pub(crate) mod base {
115115
write_simple_tag(writer, JUSTIFICATION_TAG, &justification.0)?;
116116
}
117117

118-
if let Some(responses) = &self.responses {
118+
if let Some(responses) = &self.response {
119119
write_start_tag(writer, RESPONSES_TAG)?;
120120

121121
for response in responses {
@@ -227,7 +227,7 @@ pub(crate) mod base {
227227
Ok(Self {
228228
state,
229229
justification,
230-
responses,
230+
response: responses,
231231
detail,
232232
#[versioned("1.5")]
233233
first_issued,
@@ -302,7 +302,7 @@ pub(crate) mod base {
302302
justification: Some(ImpactAnalysisJustification(
303303
"code_not_reachable".to_string(),
304304
)),
305-
responses: Some(vec![ImpactAnalysisResponse("update".to_string())]),
305+
response: Some(vec![ImpactAnalysisResponse("update".to_string())]),
306306
detail: Some("detail".to_string()),
307307
}
308308
}
@@ -314,7 +314,7 @@ pub(crate) mod base {
314314
justification: Some(ImpactAnalysisJustification(
315315
"code_not_reachable".to_string(),
316316
)),
317-
responses: Some(vec![ImpactAnalysisResponse("update".to_string())]),
317+
response: Some(vec![ImpactAnalysisResponse("update".to_string())]),
318318
detail: Some("detail".to_string()),
319319
first_issued: Some("2024-01-02".to_string()),
320320
last_updated: Some("2024-01-10".to_string()),

cyclonedx-bom/tests/spec/snapshots/1.4/it_should_parse_all_of_the_valid_json_specifications@valid-vulnerability-1.4.json.snap

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
source: cyclonedx-bom/tests/specification_tests_v1_4.rs
33
expression: bom_output
4-
input_file: cyclonedx-bom/tests/data/1.4/valid-vulnerability-1.4.json
4+
input_file: cyclonedx-bom/tests/spec/1.4/valid-vulnerability-1.4.json
55
---
66
{
77
"bomFormat": "CycloneDX",
@@ -100,6 +100,10 @@ input_file: cyclonedx-bom/tests/data/1.4/valid-vulnerability-1.4.json
100100
"analysis": {
101101
"state": "not_affected",
102102
"justification": "code_not_reachable",
103+
"response": [
104+
"will_not_fix",
105+
"update"
106+
],
103107
"detail": "An optional explanation of why the application is not affected by the vulnerable component."
104108
},
105109
"affects": [

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: cyclonedx-bom/tests/specification_tests_v1_5.rs
3-
assertion_line: 55
43
expression: bom_output
54
input_file: cyclonedx-bom/tests/spec/1.5/valid-vulnerability-1.5.json
65
---
@@ -128,6 +127,10 @@ input_file: cyclonedx-bom/tests/spec/1.5/valid-vulnerability-1.5.json
128127
"analysis": {
129128
"state": "not_affected",
130129
"justification": "code_not_reachable",
130+
"response": [
131+
"will_not_fix",
132+
"update"
133+
],
131134
"detail": "An optional explanation of why the application is not affected by the vulnerable component.",
132135
"firstIssued": "2022-01-01T00:00:00.000Z",
133136
"lastUpdated": "2022-02-01T00:00:00.000Z"

0 commit comments

Comments
 (0)