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

Avoid null fields #698

Open
pvdrz opened this issue May 9, 2024 · 0 comments
Open

Avoid null fields #698

pvdrz opened this issue May 9, 2024 · 0 comments

Comments

@pvdrz
Copy link
Contributor

pvdrz commented May 9, 2024

As shown in #695 and #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 😅. 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<T> type.
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

No branches or pull requests

1 participant