Skip to content

Commit 5dcfc54

Browse files
authored
Merge pull request #1867 from l3montree-dev/fix/docs-inconsistency
Updates api docs
2 parents f750b0c + 93a48fe commit 5dcfc54

5 files changed

Lines changed: 1070 additions & 57 deletions

File tree

controllers/artifact_controller.go

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func informationSourceToString(source informationSource) string {
9393
// @Param assetVersionSlug path string true "Asset version slug"
9494
// @Param body body object true "Artifact data"
9595
// @Success 201 {object} models.Artifact
96-
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts [post]
96+
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/ [post]
9797
func (c *ArtifactController) Create(ctx shared.Context) error {
9898
asset := shared.GetAsset(ctx)
9999

@@ -225,7 +225,7 @@ func (c *ArtifactController) Create(ctx shared.Context) error {
225225
// @Param assetVersionSlug path string true "Asset version slug"
226226
// @Param artifactName path string true "Artifact name"
227227
// @Success 200
228-
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName} [delete]
228+
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName}/ [delete]
229229
func (c *ArtifactController) DeleteArtifact(ctx shared.Context) error {
230230
asset := shared.GetAsset(ctx)
231231
reqCtx := ctx.Request().Context()
@@ -286,7 +286,7 @@ func (c *ArtifactController) DeleteArtifact(ctx shared.Context) error {
286286
// @Param artifactName path string true "Artifact name"
287287
// @Param body body object true "Artifact data"
288288
// @Success 200 {object} object
289-
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName} [put]
289+
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName}/ [put]
290290
func (c *ArtifactController) UpdateArtifact(ctx shared.Context) error {
291291

292292
asset := shared.GetAsset(ctx)
@@ -439,7 +439,7 @@ func (c *ArtifactController) UpdateArtifact(ctx shared.Context) error {
439439
// @Param assetVersionSlug path string true "Asset version slug"
440440
// @Param artifactName path string true "Artifact name"
441441
// @Success 200 {object} object
442-
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName}/sbom.json [get]
442+
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName}/sbom.json/ [get]
443443
func (c *ArtifactController) SBOMJSON(ctx shared.Context) error {
444444
assetVersion := shared.GetAssetVersion(ctx)
445445

@@ -461,6 +461,17 @@ func (c *ArtifactController) SBOMJSON(ctx shared.Context) error {
461461
return encoder.Encode(sbom.ToCycloneDX(ctxToBOMMetadata(ctx)))
462462
}
463463

464+
// @Summary Get SBOM in XML format
465+
// @Tags Artifacts
466+
// @Security CookieAuth
467+
// @Security PATAuth
468+
// @Param organization path string true "Organization slug"
469+
// @Param projectSlug path string true "Project slug"
470+
// @Param assetSlug path string true "Asset slug"
471+
// @Param assetVersionSlug path string true "Asset version slug"
472+
// @Param artifactName path string true "Artifact name"
473+
// @Success 200 {object} object
474+
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName}/sbom.xml/ [get]
464475
func (c *ArtifactController) SBOMXML(ctx shared.Context) error {
465476
assetVersion := shared.GetAssetVersion(ctx)
466477
sbom, err := c.assetVersionService.LoadFullSBOMGraph(ctx.Request().Context(), nil, assetVersion)
@@ -476,6 +487,17 @@ func (c *ArtifactController) SBOMXML(ctx shared.Context) error {
476487
return encoder.Encode(sbom.ToCycloneDX(ctxToBOMMetadata(ctx)))
477488
}
478489

490+
// @Summary Get VEX in XML format
491+
// @Tags Artifacts
492+
// @Security CookieAuth
493+
// @Security PATAuth
494+
// @Param organization path string true "Organization slug"
495+
// @Param projectSlug path string true "Project slug"
496+
// @Param assetSlug path string true "Asset slug"
497+
// @Param assetVersionSlug path string true "Asset version slug"
498+
// @Param artifactName path string true "Artifact name"
499+
// @Success 200 {object} object
500+
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName}/vex.xml/ [get]
479501
func (c *ArtifactController) VEXXML(ctx shared.Context) error {
480502
sbom, err := c.buildVeX(ctx)
481503
if err != nil {
@@ -497,7 +519,7 @@ func (c *ArtifactController) VEXXML(ctx shared.Context) error {
497519
// @Param assetVersionSlug path string true "Asset version slug"
498520
// @Param artifactName path string true "Artifact name"
499521
// @Success 200 {object} object
500-
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName}/vex.json [get]
522+
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName}/vex.json/ [get]
501523
func (c *ArtifactController) VEXJSON(ctx shared.Context) error {
502524
sbom, err := c.buildVeX(ctx)
503525
if err != nil {
@@ -510,6 +532,17 @@ func (c *ArtifactController) VEXJSON(ctx shared.Context) error {
510532
return encoder.Encode(sbom.ToCycloneDX(ctxToBOMMetadata(ctx)))
511533
}
512534

535+
// @Summary Get VEX in OpenVEX JSON format
536+
// @Tags Artifacts
537+
// @Security CookieAuth
538+
// @Security PATAuth
539+
// @Param organization path string true "Organization slug"
540+
// @Param projectSlug path string true "Project slug"
541+
// @Param assetSlug path string true "Asset slug"
542+
// @Param assetVersionSlug path string true "Asset version slug"
543+
// @Param artifactName path string true "Artifact name"
544+
// @Success 200 {object} object
545+
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName}/openvex.json/ [get]
513546
func (c *ArtifactController) OpenVEXJSON(ctx shared.Context) error {
514547
vex, err := c.buildOpenVeX(ctx)
515548
if err != nil {
@@ -553,6 +586,17 @@ func (c *ArtifactController) buildVeX(ctx shared.Context) (*normalize.SBOMGraph,
553586
return c.assetVersionService.BuildVeX(ctx.Request().Context(), nil, frontendURL, org.Name, org.Slug, project.Slug, asset, assetVersion, dependencyVulns), nil
554587
}
555588

589+
// @Summary Get vulnerability report as PDF
590+
// @Tags Artifacts
591+
// @Security CookieAuth
592+
// @Security PATAuth
593+
// @Param organization path string true "Organization slug"
594+
// @Param projectSlug path string true "Project slug"
595+
// @Param assetSlug path string true "Asset slug"
596+
// @Param assetVersionSlug path string true "Asset version slug"
597+
// @Param artifactName path string true "Artifact name"
598+
// @Success 200 {object} object
599+
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName}/vulnerability-report.pdf/ [get]
556600
func (c *ArtifactController) BuildVulnerabilityReportPDF(ctx shared.Context) error {
557601
assetVersion := shared.GetAssetVersion(ctx)
558602
org := shared.GetOrg(ctx)
@@ -763,6 +807,17 @@ func (c *ArtifactController) BuildVulnerabilityReportPDF(ctx shared.Context) err
763807
return err
764808
}
765809

810+
// @Summary Get SBOM as PDF
811+
// @Tags Artifacts
812+
// @Security CookieAuth
813+
// @Security PATAuth
814+
// @Param organization path string true "Organization slug"
815+
// @Param projectSlug path string true "Project slug"
816+
// @Param assetSlug path string true "Asset slug"
817+
// @Param assetVersionSlug path string true "Asset version slug"
818+
// @Param artifactName path string true "Artifact name"
819+
// @Success 200 {object} object
820+
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug}/artifacts/{artifactName}/sbom.pdf/ [get]
766821
func (c *ArtifactController) BuildPDFFromSBOM(ctx shared.Context) error {
767822
assetVersion := shared.GetAssetVersion(ctx)
768823
sbom, err := c.assetVersionService.LoadFullSBOMGraph(ctx.Request().Context(), nil, assetVersion)

controllers/asset_version_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func NewAssetVersionController(
6363
// @Param projectSlug path string true "Project slug"
6464
// @Param assetSlug path string true "Asset slug"
6565
// @Param assetVersionSlug path string true "Asset version slug"
66-
// @Success 200 {object} dtos.AssetVersionModel
66+
// @Success 200 {object} dtos.AssetVersionDTO
6767
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs/{assetVersionSlug} [get]
6868
func (a *AssetVersionController) Read(ctx shared.Context) error {
6969
assetVersion := shared.GetAssetVersion(ctx)
@@ -78,7 +78,7 @@ func (a *AssetVersionController) Read(ctx shared.Context) error {
7878
// @Param projectSlug path string true "Project slug"
7979
// @Param assetSlug path string true "Asset slug"
8080
// @Param body body object{name=string,tag=bool,defaultBranch=bool} true "Request body"
81-
// @Success 201 {object} dtos.AssetVersionModel
81+
// @Success 201 {object} dtos.AssetVersionDTO
8282
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs [post]
8383
func (a *AssetVersionController) Create(ctx shared.Context) error {
8484
asset := shared.GetAsset(ctx)
@@ -133,7 +133,7 @@ func (a *AssetVersionController) Delete(ctx shared.Context) error {
133133
// @Param organization path string true "Organization slug"
134134
// @Param projectSlug path string true "Project slug"
135135
// @Param assetSlug path string true "Asset slug"
136-
// @Success 200 {array} []dtos.AssetVersionModel
136+
// @Success 200 {array} []dtos.AssetVersionDTO
137137
// @Router /organizations/{organization}/projects/{projectSlug}/assets/{assetSlug}/refs [get]
138138
func (a *AssetVersionController) GetAssetVersionsByAssetID(ctx shared.Context) error {
139139
asset := shared.GetAsset(ctx)

controllers/org_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ func (controller *OrgController) GetConfigFile(ctx shared.Context) error {
391391
// @Security PATAuth
392392
// @Param organization path string true "Organization slug"
393393
// @Param config-file path string true "Config file ID"
394-
// @Param body string true "Config file content"
394+
// @Param body body string true "Config file content"
395395
// @Success 200 {string} string
396396
// @Router /organizations/{organization}/config-files/{config-file} [put]
397397
func (controller *OrgController) UpdateConfigFile(ctx shared.Context) error {

0 commit comments

Comments
 (0)