-
-
Notifications
You must be signed in to change notification settings - Fork 54
feat: add models.OrganizationalEntity.bom_ref
#801
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Yowgf, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request addresses issue #799 by adding the bom_ref property to the OrganizationalEntity class in cyclonedx/model/contact.py. This allows for referencing the organizational entity elsewhere in the BOM using a unique identifier. The pull request also includes corresponding tests in tests/test_model.py to ensure the new functionality works as expected, including initialization with and without a bom_ref, and serialization from JSON.
Highlights
- Feature Addition: Adds the
bom_refproperty to theOrganizationalEntityclass, enabling unique identification and referencing of organizational entities within a BOM. - Model Changes: Modifies the
OrganizationalEntityclass incyclonedx/model/contact.pyto include thebom_refproperty with appropriate serialization and deserialization support. - Testing: Includes new tests in
tests/test_model.pyto validate the functionality of thebom_refproperty, including initialization and JSON serialization.
Changelog
- cyclonedx/model/contact.py
- Added
bom_refparameter to theOrganizationalEntity's__init__method (line 291). - Added
_bom_refattribute to store thebom_refvalue (line 297). - Implemented the
bom_refproperty with JSON and XML serialization support (lines 303-316).
- Added
- tests/test_model.py
- Added import for
OrganizationalEntityandPostalAddress(line 43). - Added
TestModelOrganizationalEntityclass with tests for initialization with and withoutbom_ref(lines 467-495). - Added a test case to initialize
OrganizationalEntityfrom JSON, asserting the correct parsing ofname,urls, andbom-ref(lines 497-511).
- Added import for
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Trivia time!
What is the purpose of a Bill of Materials (BOM) in software development?
Click here for the answer
A Bill of Materials (BOM) in software development is a comprehensive inventory of all the components, libraries, and dependencies used in a software project. It helps in managing dependencies, ensuring security, and facilitating compliance.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces the bom_ref attribute to the OrganizationalEntity class, enhancing its ability to be referenced within a BOM. The addition of tests is also a good practice. Here are some suggestions for improvement.
Summary of Findings
- Missing
from_jsontest coverage: TheOrganizationalEntityclass now has abom_refattribute, but thefrom_jsonmethod in the test suite does not cover this new attribute. Adding a test case to ensure thatbom_refis correctly deserialized from JSON would improve the robustness of the code.
Merge Readiness
The code changes introduce a new feature and include unit tests, which is good. However, there's a missing test case for the from_json method to ensure the bom_ref attribute is correctly deserialized. I recommend addressing this before merging. I am unable to approve this pull request, and other reviewers should review and approve this code before merging.
Signed-off-by: yowgf <[email protected]>
Signed-off-by: yowgf <[email protected]>
|
@Yowgf , Afterwards, run update test snapshots as described here: https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/tests/_data/snapshots/README.md |
Signed-off-by: yowgf <[email protected]>
|
@jkowalleck done. Thanks for the heads up. |
| """regression test for issue #799 | ||
| see https://github.com/CycloneDX/cyclonedx-python-lib/issues/799 | ||
| """ | ||
| return _make_bom( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please don't use the $.metadata.tools.services for this use case, as this particular structure is not available in all versions of CycloneDX, as this would render this test case almost unused.
please use $.components[].supplier instead.
models.OrganizationalEntity.bom_ref
Changes for the issue #799