Skip to content

Commit

Permalink
Rename scan request type
Browse files Browse the repository at this point in the history
Signed-off-by: stonezdj <[email protected]>
  • Loading branch information
stonezdj committed Apr 17, 2024
1 parent 6709c78 commit 49d6636
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
11 changes: 2 additions & 9 deletions api/v2.0/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1176,11 +1176,11 @@ paths:
- $ref: '#/parameters/projectName'
- $ref: '#/parameters/repositoryName'
- $ref: '#/parameters/reference'
- name: scan_request_type
- name: scanType
in: body
required: false
schema:
$ref: '#/definitions/ScanRequestType'
$ref: '#/definitions/ScanType'
responses:
'202':
$ref: '#/responses/202'
Expand Down Expand Up @@ -6766,13 +6766,6 @@ definitions:
type: string
description: Version of the scanner adapter
example: "v0.9.1"
ScanRequestType:
type: object
properties:
scan_type:
type: string
description: 'The scan type for the scan request. Two options are currently supported, vulnerability and sbom'
enum: [vulnerability, sbom]
ScanOverview:
type: object
description: 'The scan overview attached in the metadata of tag'
Expand Down
4 changes: 2 additions & 2 deletions src/server/v2.0/handler/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ func (s *scanAPI) ScanArtifact(ctx context.Context, params operation.ScanArtifac
if !distribution.IsDigest(params.Reference) {
options = append(options, scan.WithTag(params.Reference))
}
if params.ScanRequestType != nil && validScanType(params.ScanRequestType.ScanType) {
scanType = params.ScanRequestType.ScanType
if params.ScanType != nil && validScanType(params.ScanType.ScanType) {
scanType = params.ScanType.ScanType

Check warning on line 86 in src/server/v2.0/handler/scan.go

View check run for this annotation

Codecov / codecov/patch

src/server/v2.0/handler/scan.go#L85-L86

Added lines #L85 - L86 were not covered by tests
options = append(options, scan.WithScanType(scanType))
}
res := rbac.ResourceScan
Expand Down

0 comments on commit 49d6636

Please sign in to comment.