CycloneDX / CycloneDX/cyclonedx-rust-cargo
Avoid null fields
- Dominant language
- Rust
- Stars
- 178
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
As shown in https://github.com/CycloneDX/cyclonedx-rust-cargo/pull/695 and https://github.com/CycloneDX/cyclonedx-rust-cargo/pull/694. Some of the snapshot files contain `null` objects that are consequence of forgetting sprinking `#[serde(skip_serializing_if = "Option::is_none")` in some optional fields.
Considering that I was one of the people that forgot to add the attribute :sweat_smile:. I think it would be nice if:
- A test verifies that snapshot files never contain `null` objects.
- This behavior could be derived automatically via the `cyclonedx-bom-macros` crates. Basically adding a new attribute macro that expands by adding `#[serde(skip_serializing_if = "Option::is_none")` to all fields with `Option` type.
Contributor guide
Research direction
Review the snapshot files and the existing tests to identify where null objects are currently produced, using pull requests 695 and 694 as context. Then inspect the cyclonedx-bom-macros crates and the optional fields involved. Done means a test rejects null objects in snapshots and the proposed attribute macro handles Option fields automatically.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- testing, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100