Closed dwertent closed 6 months ago
PR Description updated to latest commit (https://github.com/kubescape/storage/commit/f704a3ad824bb2f73584d101f3ba3f438977138f)
v1beta1
version. It includes changes to make certain fields optional in various structs, updating import paths to point to the v1beta1
version, and adjusting test cases to reflect these changes.๐ก General suggestions: The PR seems to be well-structured and follows good practices. The changes are clear and the updates to the tests are appropriate. However, it would be beneficial to include more context or reasoning behind why certain fields are now optional.
relevant file | pkg/apis/softwarecomposition/v1beta1/network_types.go |
suggestion | Consider adding a comment explaining why `PoliciesRef` is now optional. This would provide more context to other developers and maintainers. [medium] |
relevant line | PoliciesRef []PolicyRef `json:"policyRef,omitempty"` |
relevant file | pkg/apis/softwarecomposition/v1beta1/types.go |
suggestion | Similar to the previous suggestion, it would be helpful to add a comment explaining why `Relevant` and `WorkloadVulnerabilitiesObj` are now optional. [medium] |
relevant line | Relevant int `json:"relevant,omitempty"` |
relevant file | pkg/registry/file/generatednetworkpolicy_test.go |
suggestion | It might be beneficial to add more test cases to cover the new optional fields when they are not provided. This would ensure that the code behaves as expected in these scenarios. [important] |
relevant line | objPtr: &softwarecomposition.GeneratedNetworkPolicy{}, |
Summary:
Type
enhancement, tests
Description
This PR focuses on moving the Network Policy generation to the
v1beta1
version. The main changes include:omitempty
to their JSON tags. These fields includePoliciesRef
inGeneratedNetworkPolicy
,Relevant
inVulnerabilityCounters
, andWorkloadVulnerabilitiesObj
inVulnerabilitiesComponents
.softwarecomposition
andnetworkpolicy
in several files to point to thev1beta1
version.networkpolicy_test.go
andgeneratednetworkpolicy_test.go
to reflect the updated import paths.PR changes walkthrough
4 files
network_types.go
pkg/apis/softwarecomposition/v1beta1/network_types.go
**Made the `PoliciesRef` field in the `GeneratedNetworkPolicy`
struct optional by adding `omitempty` to its JSON tag.**
networkpolicy.go
pkg/apis/softwarecomposition/v1beta1/networkpolicy/networkpolicy.go
**Updated the import path for `softwarecomposition` to point
to the `v1beta1` version.**
types.go
pkg/apis/softwarecomposition/v1beta1/types.go
**Made the `Relevant` field in the `VulnerabilityCounters`
struct and the `WorkloadVulnerabilitiesObj` field in the
`VulnerabilitiesComponents` struct optional by adding
`omitempty` to their JSON tags.**
generatednetworkpolicy.go
pkg/registry/file/generatednetworkpolicy.go
**Updated the import paths for `softwarecomposition` and
`networkpolicy` to point to the `v1beta1` version.**
2 files
networkpolicy_test.go
pkg/apis/softwarecomposition/v1beta1/networkpolicy/networkpolicy_test.go
**Updated the import path for `softwarecomposition` in the
test file to point to the `v1beta1` version.**
generatednetworkpolicy_test.go
pkg/registry/file/generatednetworkpolicy_test.go
**Updated the import path for `softwarecomposition` in the
test file to point to the `v1beta1` version. Also, made
changes in the test cases to reflect the updated import
paths.**
User description
Sorry, we do not accept changes directly against this repository. Please see CONTRIBUTING.md for information on where and how to contribute instead.