fix(swagger): append scan report version 1.1 to swagger docs (#16965)

fix(swagger): append scan report version 1.1 to swagger docs default value

The default value of swagger header X-Accept-Vulnerabilities should contains
scan report version 1.0 and 1.1.

Signed-off-by: chlins <chenyuzh@vmware.com>
This commit is contained in:
Chenyu Zhang 2022-06-10 16:38:43 +08:00 committed by GitHub
parent e778ec2edf
commit e08ad05659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -5610,7 +5610,7 @@ parameters:
name: X-Accept-Vulnerabilities
in: header
type: string
default: 'application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0'
default: 'application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0'
description: |-
A comma-separated lists of MIME types for the scan report or scan summary. The first mime type will be used when the report found for it.
Currently the mime type supports 'application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' and 'application/vnd.security.vulnerability.report; version=1.1'

View File

@ -116,7 +116,7 @@ func (suite *ArtifactTestSuite) TestGetVulnerabilitiesAddition() {
suite.onGetReport(v1.MimeTypeNativeReport)
var body map[string]interface{}
res, err := suite.GetJSON(url, &body)
res, err := suite.GetJSON(url, &body, map[string]string{"X-Accept-Vulnerabilities": v1.MimeTypeNativeReport})
suite.NoError(err)
suite.Equal(200, res.StatusCode)
suite.Empty(body)
@ -127,7 +127,7 @@ func (suite *ArtifactTestSuite) TestGetVulnerabilitiesAddition() {
suite.onGetReport(v1.MimeTypeNativeReport, suite.report1)
var body map[string]interface{}
res, err := suite.GetJSON(url, &body)
res, err := suite.GetJSON(url, &body, map[string]string{"X-Accept-Vulnerabilities": v1.MimeTypeNativeReport})
suite.NoError(err)
suite.Equal(200, res.StatusCode)
suite.NotEmpty(body)