Skip to content

Commit b3e8396

Browse files
authored
Fixes #89. JSON format outputs bom file version as an integer to follow to the CycloneDX JSON Schema. (#90)
Signed-off-by: Kyle Hammond <[email protected]>
1 parent 851a352 commit b3e8396

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.0.1]
8+
9+
### Fixed
10+
- Fixed JSON output to use an integer for the bom file version number. ([Issue #89](https://github.com/CycloneDX/cyclonedx-cocoapods/issues/89)) [@macblazer](https://github.com/macblazer).
11+
712
## [2.0.0]
813

914
### Added

example_bom.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"bomFormat": "CycloneDX",
44
"specVersion": "1.6",
55
"serialNumber": "urn:uuid:b57875d9-a259-4c91-b04b-1e8894898089",
6-
"version": "1",
6+
"version": 1,
77
"metadata":
88
{
99
"timestamp": "2025-01-07T03:54:06Z",

lib/cyclonedx/cocoapods/bom_builder.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def generate_json(version:, trim_strings_length:)
403403
bomFormat: 'CycloneDX',
404404
specVersion: '1.6',
405405
serialNumber: "urn:uuid:#{SecureRandom.uuid}",
406-
version: version.to_s,
406+
version: version.to_i,
407407
metadata: generate_json_metadata,
408408
components: generate_json_components(trim_strings_length),
409409
dependencies: generate_json_dependencies
@@ -440,6 +440,7 @@ def generate_json_dependencies
440440
}
441441
end
442442
end
443+
443444
def bom_components(xml, pods, manifest_path, trim_strings_length)
444445
xml.components do
445446
pods.each do |pod|
@@ -468,6 +469,7 @@ def bom_metadata(xml)
468469
manufacturer&.add_to_bom(xml)
469470
end
470471
end
472+
471473
def bom_tools(xml)
472474
xml.tools do
473475
xml.components do

lib/cyclonedx/cocoapods/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121

2222
module CycloneDX
2323
module CocoaPods
24-
VERSION = '2.0.0'
24+
VERSION = '2.0.1'
2525
end
2626
end

spec/cyclonedx/cocoapods/bom_builder_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@
13531353
it 'should generate proper root level attributes' do
13541354
expect(bom_json[:bomFormat]).to eq('CycloneDX')
13551355
expect(bom_json[:specVersion]).to eq('1.6')
1356-
expect(bom_json[:version]).to eq(version.to_s)
1356+
expect(bom_json[:version]).to eq(version.to_i)
13571357
expect(bom_json[:serialNumber]).to match(/urn:uuid:.*/)
13581358
end
13591359

0 commit comments

Comments
 (0)