Skip to content

Commit 6732996

Browse files
feat: extend public API to include PR status and component type in SPDX response (#221)
Co-authored-by: Kostyantyn Zagorodniy <kostyantyn.zagorodniy@mercedes-benz.com>
1 parent b9acf6c commit 6732996

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

backend/domain/project/rest.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ type SpdxStatusComponent struct {
467467
License string `json:"license" example:"MIT"`
468468
Name string `json:"name" example:"@some/component"`
469469
Version string `json:"version" example:"7.19.6"`
470+
PrStatus string `json:"prStatus" example:"noassertion"`
471+
Type components.ComponentType `json:"type" example:"Package"`
470472
ScanRemarks []SpdxStatusScanRemarks `json:"scanRemarks"`
471473
LicenseRemarks []SpdxStatusLicenseRemarks `json:"licenseRemarks"`
472474
PolicyRuleStatus []SpdxStatusPolicy `json:"policyRuleStatus"`

backend/infra/rest/projectVersion.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,13 +2093,18 @@ func (projectHandler *ProjectHandler) CreateProjectSPDXExternCheck(requestSessio
20932093
components := make([]project.SpdxStatusComponent, 0)
20942094
for _, compRes := range evalRes.Results {
20952095
componentInfoElement := compRes.Component
2096+
20962097
statusComponent := project.SpdxStatusComponent{
20972098
SpdxId: componentInfoElement.SpdxId,
20982099
License: componentInfoElement.GetLicenseEffective(),
20992100
Name: componentInfoElement.Name,
21002101
Version: componentInfoElement.Version,
2102+
Type: componentInfoElement.Type,
21012103
}
21022104

2105+
usedPolicyRule, _ := compRes.GetUsedPolicyRule()
2106+
statusComponent.PrStatus = usedPolicyRule
2107+
21032108
if compRes.Status != nil {
21042109
policyRuleStatus := make([]project.SpdxStatusPolicy, 0)
21052110
for _, policyRule := range compRes.Status {

0 commit comments

Comments
 (0)