File tree Expand file tree Collapse file tree 4 files changed +11
-6
lines changed Expand file tree Collapse file tree 4 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ All notable changes to this project will be documented in this file.
1313 * Static function ` Models.Tool.fromComponent() ` (via [ #1163 ] )
1414 * Static function ` Models.Tool.fromService() ` (via [ #1163 ] )
1515 * New class ` Models.Tools ` ([ #1152 ] via [ #1163 ] )
16- * New serialization/normalization for ` Models.Tools ` ([ #1152 ] via [ #1163 ] )
16+ * New serialization/normalization for ` Models.Tools ` ([ #1152 ] via [ #1163 ] , [ # 1180 ] )
1717* Changed
1818 * Serializers and ` Bom ` -Normalizers will take changed ` Models.Bom.tools ` into account ([ #1152 ] via [ #1163 ] )
1919* Dependencies
@@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file.
2424[ #1152 ] : https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1152
2525[ #1163 ] : https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1163
2626[ #1173 ] : https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1173
27+ [ #1180 ] : https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1180
2728
2829## 6.13.0 -- 2024-11-18
2930
Original file line number Diff line number Diff line change @@ -302,8 +302,12 @@ export class ToolsNormalizer extends BaseJsonNormalizer<Models.Tools> {
302302 ) ) , options )
303303 }
304304 return {
305- components : this . _factory . makeForComponent ( ) . normalizeIterable ( data . components , options ) ,
306- services : this . _factory . makeForService ( ) . normalizeIterable ( data . services , options )
305+ components : data . components . size > 0
306+ ? this . _factory . makeForComponent ( ) . normalizeIterable ( data . components , options )
307+ : undefined ,
308+ services : data . services . size > 0
309+ ? this . _factory . makeForService ( ) . normalizeIterable ( data . services , options )
310+ : undefined
307311 }
308312 }
309313}
Original file line number Diff line number Diff line change @@ -120,8 +120,8 @@ export namespace Normalized {
120120
121121 /** since CDX 1.5 */
122122 export interface Tools {
123- components : Component [ ]
124- services : Service [ ]
123+ components ? : Component [ ]
124+ services ? : Service [ ]
125125 }
126126
127127 export type ToolsType = Tools | Tool [ ]
Original file line number Diff line number Diff line change @@ -389,7 +389,7 @@ export class ToolsNormalizer extends BaseXmlNormalizer<Models.Tools> {
389389 children : this . _factory . makeForComponent ( ) . normalizeIterable ( data . components , options , 'component' )
390390 } )
391391 }
392- if ( data . components . size > 0 ) {
392+ if ( data . services . size > 0 ) {
393393 children . push ( {
394394 type : 'element' ,
395395 name : 'services' ,
You can’t perform that action at this time.
0 commit comments