Skip to content
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

Update 'version' to be required field #618

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

justahero
Copy link
Contributor

According to the JSON specification (in 1.3 & 1.4) the top-level field 'version' is required, it defaults to 1.

Therefore the field is refactored to not be optional.

  • update conversion & serialization functions

According to the JSON specification (in [1.3](https://cyclonedx.org/docs/1.3/json/#version) & [1.4](https://cyclonedx.org/docs/1.4/json/#version)) the top-level field 'version' is required, it defaults to 1.

Therefore the field is refactored to not be optional.

* update conversion & serialization functions

Signed-off-by: Sebastian Ziebell <sebastian.ziebell@ferrous-systems.com>
@justahero justahero requested a review from a team as a code owner February 12, 2024 09:14
@Shnatsel Shnatsel merged commit cf4fab5 into CycloneDX:main Feb 12, 2024
9 checks passed
@justahero justahero deleted the refactor-bom-version branch February 13, 2024 09:07
@Shnatsel
Copy link
Contributor

Now that I am actually using this in cargo auditable, it seems that this is not a good idea. Making it required results in it always being written to the BOM, which prevents clean roundtrips. And version: 1 is redundant because the spec states it should be treated as 1 if not present, and takes up valuable space in the cargo auditable use case.

I would like to revert this in the next semver-breaking release, to give the caller more control over the serialized SBOM and enable cleaner roundtrips with fewer alterations. I would also like to provide an accessor function instead that returns the version if set or 1 if not in the next release, to get easy access to the spec-compliant logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants