0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00

fix: referrers now appears in swagger generated docs (#1488)

Signed-off-by: Lisca Ana-Roberta <ana.kagome@yahoo.com>
This commit is contained in:
Lisca Ana-Roberta 2023-06-12 20:32:11 +03:00 committed by GitHub
parent 4d6ca493f2
commit 622dde9193
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 679 additions and 105 deletions

View file

@ -25,7 +25,7 @@ CRICTL_VERSION := v1.26.1
ACTION_VALIDATOR := $(TOOLSDIR)/bin/action-validator ACTION_VALIDATOR := $(TOOLSDIR)/bin/action-validator
ACTION_VALIDATOR_VERSION := v0.2.1 ACTION_VALIDATOR_VERSION := v0.2.1
ZUI_VERSION := commit-05d5f74 ZUI_VERSION := commit-05d5f74
SWAGGER_VERSION := 1.8.12 SWAGGER_VERSION := v1.8.12
STACKER := $(TOOLSDIR)/bin/stacker STACKER := $(TOOLSDIR)/bin/stacker
BATS := $(TOOLSDIR)/bin/bats BATS := $(TOOLSDIR)/bin/bats
TESTDATA := $(TOP_LEVEL)/test/data TESTDATA := $(TOP_LEVEL)/test/data
@ -205,7 +205,7 @@ check: ./golangcilint.yaml $(GOLINTER)
swagger/docs.go: swagger/docs.go:
swag -v || go install github.com/swaggo/swag/cmd/swag@$(SWAGGER_VERSION) swag -v || go install github.com/swaggo/swag/cmd/swag@$(SWAGGER_VERSION)
swag init -o swagger -g pkg/api/routes.go swag init --parseDependency -o swagger -g pkg/api/routes.go -q
.PHONY: swagger .PHONY: swagger
swagger: swagger/docs.go pkg/api/routes.go swagger: swagger/docs.go pkg/api/routes.go

1
go.mod
View file

@ -5,7 +5,6 @@ go 1.20
require ( require (
github.com/99designs/gqlgen v0.17.31 github.com/99designs/gqlgen v0.17.31
github.com/Masterminds/semver v1.5.0 github.com/Masterminds/semver v1.5.0
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/apex/log v1.9.0 github.com/apex/log v1.9.0
github.com/aquasecurity/trivy-db v0.0.0-20230515061101-378ab9ed302c github.com/aquasecurity/trivy-db v0.0.0-20230515061101-378ab9ed302c
github.com/bmatcuk/doublestar/v4 v4.6.0 github.com/bmatcuk/doublestar/v4 v4.6.0

2
go.sum
View file

@ -308,8 +308,6 @@ github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVb
github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek= github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek=
github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.2/go.mod h1:sCavSAvdzOjul4cEqeVtvlSaSScfNsTQ+46HwlTL1hc= github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.2/go.mod h1:sCavSAvdzOjul4cEqeVtvlSaSScfNsTQ+46HwlTL1hc=
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 h1:iC9YFYKDGEy3n/FtqJnOkZsene9olVspKmkX5A2YBEo= github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 h1:iC9YFYKDGEy3n/FtqJnOkZsene9olVspKmkX5A2YBEo=

View file

@ -509,16 +509,17 @@ func getReferrers(routeHandler *RouteHandler,
} }
// GetReferrers godoc // GetReferrers godoc
// @Summary Get references for a given digest // @Summary Get referrers for a given digest
// @Description Get references given a digest // @Description Get referrers given a digest
// @Accept json // @Accept json
// @Produce application/vnd.oci.image.index.v1+json // @Produce application/vnd.oci.image.index.v1+json
// @Param name path string true "repository name" // @Param name path string true "repository name"
// @Param digest path string true "digest" // @Param digest path string true "digest"
// @Param artifactType query string false "artifact type"
// @Success 200 {object} api.ImageIndex // @Success 200 {object} api.ImageIndex
// @Failure 404 {string} string "not found" // @Failure 404 {string} string "not found"
// @Failure 500 {string} string "internal server error" // @Failure 500 {string} string "internal server error"
// @Router /v2/{name}/references/{digest} [get]. // @Router /v2/{name}/referrers/{digest} [get].
func (rh *RouteHandler) GetReferrers(response http.ResponseWriter, request *http.Request) { func (rh *RouteHandler) GetReferrers(response http.ResponseWriter, request *http.Request) {
response.Header().Set("Access-Control-Allow-Methods", "HEAD,GET,POST,OPTIONS") response.Header().Set("Access-Control-Allow-Methods", "HEAD,GET,POST,OPTIONS")
response.Header().Set("Access-Control-Allow-Headers", "Authorization,content-type") response.Header().Set("Access-Control-Allow-Headers", "Authorization,content-type")
@ -1798,7 +1799,7 @@ type ReferenceList struct {
// @Success 200 {string} string "ok" // @Success 200 {string} string "ok"
// @Failure 404 {string} string "not found" // @Failure 404 {string} string "not found"
// @Failure 500 {string} string "internal server error" // @Failure 500 {string} string "internal server error"
// @Router /oras/artifacts/v1/{name:%s}/manifests/{digest}/referrers [get]. // @Router /oras/artifacts/v1/{name}/manifests/{digest}/referrers [get].
func (rh *RouteHandler) GetOrasReferrers(response http.ResponseWriter, request *http.Request) { func (rh *RouteHandler) GetOrasReferrers(response http.ResponseWriter, request *http.Request) {
vars := mux.Vars(request) vars := mux.Vars(request)
name, ok := vars["name"] name, ok := vars["name"]

View file

@ -1,29 +1,16 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // Code generated by swaggo/swag. DO NOT EDIT.
// This file was generated by swaggo/swag at
// 2022-05-20 22:28:21.990630149 +0000 UTC m=+0.151110280
package swagger package swagger
import ( import "github.com/swaggo/swag"
"bytes"
"encoding/json"
"strings"
"github.com/alecthomas/template" const docTemplate = `{
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }}, "schemes": {{ marshal .Schemes }},
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"description": "{{.Description}}", "description": "{{escape .Description}}",
"title": "{{.Title}}", "title": "{{.Title}}",
"contact": { "contact": {},
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": { "license": {
"name": "Apache 2.0", "name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
@ -33,7 +20,7 @@ var doc = `{
"host": "{{.Host}}", "host": "{{.Host}}",
"basePath": "{{.BasePath}}", "basePath": "{{.BasePath}}",
"paths": { "paths": {
"/oras/artifacts/v1/{name}": { "/oras/artifacts/v1/{name}/manifests/{digest}/referrers": {
"get": { "get": {
"description": "Get references for an image given a digest and artifact type", "description": "Get references for an image given a digest and artifact type",
"consumes": [ "consumes": [
@ -389,7 +376,7 @@ var doc = `{
}, },
"Range": { "Range": {
"type": "string", "type": "string",
"description": "bytes=0-128" "description": "0-128"
} }
} }
}, },
@ -522,8 +509,7 @@ var doc = `{
}, },
"headers": { "headers": {
"constants.DistContentDigestKey": { "constants.DistContentDigestKey": {
"type": "object", "type": "object"
"description": "OK"
} }
} }
} }
@ -564,8 +550,7 @@ var doc = `{
}, },
"headers": { "headers": {
"constants.DistContentDigestKey": { "constants.DistContentDigestKey": {
"type": "object", "type": "object"
"description": "OK"
} }
} }
}, },
@ -702,8 +687,7 @@ var doc = `{
}, },
"headers": { "headers": {
"cosntants.DistContentDigestKey": { "cosntants.DistContentDigestKey": {
"type": "object", "type": "object"
"description": "OK"
} }
} }
}, },
@ -722,6 +706,60 @@ var doc = `{
} }
} }
}, },
"/v2/{name}/referrers/{digest}": {
"get": {
"description": "Get referrers given a digest",
"consumes": [
"application/json"
],
"produces": [
"application/vnd.oci.image.index.v1+json"
],
"summary": "Get referrers for a given digest",
"parameters": [
{
"type": "string",
"description": "repository name",
"name": "name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "digest",
"name": "digest",
"in": "path",
"required": true
},
{
"type": "string",
"description": "artifact type",
"name": "artifactType",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.ImageIndex"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal server error",
"schema": {
"type": "string"
}
}
}
}
},
"/v2/{name}/tags/list": { "/v2/{name}/tags/list": {
"get": { "get": {
"description": "List all image tags in a repository", "description": "List all image tags in a repository",
@ -780,10 +818,89 @@ var doc = `{
}, },
"definitions": { "definitions": {
"api.ExtensionList": { "api.ExtensionList": {
"type": "object" "type": "object",
"properties": {
"extensions": {
"type": "array",
"items": {
"$ref": "#/definitions/extensions.Extension"
}
}
}
},
"api.ImageIndex": {
"type": "object",
"properties": {
"annotations": {
"description": "Annotations contains arbitrary metadata for the image index.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"manifests": {
"description": "Manifests references platform specific manifests.",
"type": "array",
"items": {
"$ref": "#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Descriptor"
}
},
"mediaType": {
"description": "MediaType specifies the type of this document data structure e.g. ` + "`" + `application/vnd.oci.image.index.v1+json` + "`" + `",
"type": "string"
},
"schemaVersion": {
"description": "SchemaVersion is the image manifest schema that this image follows",
"type": "integer"
}
}
}, },
"api.ImageManifest": { "api.ImageManifest": {
"type": "object" "type": "object",
"properties": {
"annotations": {
"description": "Annotations contains arbitrary metadata for the image manifest.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"artifactType": {
"description": "ArtifactType specifies the IANA media type of artifact when the manifest is used for an artifact.",
"type": "string"
},
"config": {
"description": "Config references a configuration object for a container, by digest.\nThe referenced configuration object is a JSON blob that the runtime uses to set up the container.",
"allOf": [
{
"$ref": "#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Descriptor"
}
]
},
"layers": {
"description": "Layers is an indexed list of layers referenced by the manifest.",
"type": "array",
"items": {
"$ref": "#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Descriptor"
}
},
"mediaType": {
"description": "MediaType specifies the type of this document data structure e.g. ` + "`" + `application/vnd.oci.image.manifest.v1+json` + "`" + `",
"type": "string"
},
"schemaVersion": {
"description": "SchemaVersion is the image manifest schema that this image follows",
"type": "integer"
},
"subject": {
"description": "Subject is an optional link from the image manifest to another manifest forming an association between the image manifest and the other manifest.",
"allOf": [
{
"$ref": "#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Descriptor"
}
]
}
}
}, },
"api.ImageTags": { "api.ImageTags": {
"type": "object", "type": "object",
@ -809,57 +926,120 @@ var doc = `{
} }
} }
} }
},
"extensions.Extension": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"endpoints": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"github_com_opencontainers_image-spec_specs-go_v1.Descriptor": {
"type": "object",
"properties": {
"annotations": {
"description": "Annotations contains arbitrary metadata relating to the targeted content.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"artifactType": {
"description": "ArtifactType is the IANA media type of this artifact.",
"type": "string"
},
"data": {
"description": "Data is an embedding of the targeted content. This is encoded as a base64\nstring when marshalled to JSON (automatically, by encoding/json). If\npresent, Data can be used directly to avoid fetching the targeted content.",
"type": "array",
"items": {
"type": "integer"
}
},
"digest": {
"description": "Digest is the digest of the targeted content.",
"type": "string"
},
"mediaType": {
"description": "MediaType is the media type of the object this schema refers to.",
"type": "string"
},
"platform": {
"description": "Platform describes the platform which the image in the manifest runs on.\n\nThis should only be used when referring to a manifest.",
"allOf": [
{
"$ref": "#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Platform"
}
]
},
"size": {
"description": "Size specifies the size in bytes of the blob.",
"type": "integer"
},
"urls": {
"description": "URLs specifies a list of URLs from which this object MAY be downloaded",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"github_com_opencontainers_image-spec_specs-go_v1.Platform": {
"type": "object",
"properties": {
"architecture": {
"description": "Architecture field specifies the CPU architecture, for example\n` + "`" + `amd64` + "`" + ` or ` + "`" + `ppc64` + "`" + `.",
"type": "string"
},
"os": {
"description": "OS specifies the operating system, for example ` + "`" + `linux` + "`" + ` or ` + "`" + `windows` + "`" + `.",
"type": "string"
},
"os.features": {
"description": "OSFeatures is an optional field specifying an array of strings,\neach listing a required OS feature (for example on Windows ` + "`" + `win32k` + "`" + `).",
"type": "array",
"items": {
"type": "string"
}
},
"os.version": {
"description": "OSVersion is an optional field specifying the operating system\nversion, for example on Windows ` + "`" + `10.0.14393.1066` + "`" + `.",
"type": "string"
},
"variant": {
"description": "Variant is an optional field specifying a variant of the CPU, for\nexample ` + "`" + `v7` + "`" + ` to specify ARMv7 when architecture is ` + "`" + `arm` + "`" + `.",
"type": "string"
}
}
} }
} }
}` }`
type swaggerInfo struct {
Version string
Host string
BasePath string
Schemes []string
Title string
Description string
}
// SwaggerInfo holds exported Swagger Info so clients can modify it // SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{ var SwaggerInfo = &swag.Spec{
Version: "v1.1.0-dev", Version: "v1.1.0-dev",
Host: "", Host: "",
BasePath: "", BasePath: "",
Schemes: []string{}, Schemes: []string{},
Title: "Open Container Initiative Distribution Specification", Title: "Open Container Initiative Distribution Specification",
Description: "APIs for Open Container Initiative Distribution Specification", Description: "APIs for Open Container Initiative Distribution Specification",
} InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
type s struct{}
func New() *s {
return &s{}
}
func (s *s) ReadDoc() string {
sInfo := SwaggerInfo
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
t, err := template.New("swagger_info").Funcs(template.FuncMap{
"marshal": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
}).Parse(doc)
if err != nil {
return doc
}
var tpl bytes.Buffer
if err := t.Execute(&tpl, sInfo); err != nil {
return doc
}
return tpl.String()
} }
func init() { func init() {
swag.Register(swag.Name, &s{}) swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
} }

View file

@ -10,7 +10,7 @@ import (
func TestDocs(t *testing.T) { func TestDocs(t *testing.T) {
Convey("Read docs", t, func() { Convey("Read docs", t, func() {
s := swagger.New() s := swagger.SwaggerInfo
So(s.ReadDoc(), ShouldNotBeEmpty) So(s.ReadDoc(), ShouldNotBeEmpty)
}) })
} }

View file

@ -3,11 +3,7 @@
"info": { "info": {
"description": "APIs for Open Container Initiative Distribution Specification", "description": "APIs for Open Container Initiative Distribution Specification",
"title": "Open Container Initiative Distribution Specification", "title": "Open Container Initiative Distribution Specification",
"contact": { "contact": {},
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": { "license": {
"name": "Apache 2.0", "name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
@ -15,7 +11,7 @@
"version": "v1.1.0-dev" "version": "v1.1.0-dev"
}, },
"paths": { "paths": {
"/oras/artifacts/v1/{name": { "/oras/artifacts/v1/{name}/manifests/{digest}/referrers": {
"get": { "get": {
"description": "Get references for an image given a digest and artifact type", "description": "Get references for an image given a digest and artifact type",
"consumes": [ "consumes": [
@ -504,8 +500,7 @@
}, },
"headers": { "headers": {
"constants.DistContentDigestKey": { "constants.DistContentDigestKey": {
"type": "object", "type": "object"
"description": "OK"
} }
} }
} }
@ -546,8 +541,7 @@
}, },
"headers": { "headers": {
"constants.DistContentDigestKey": { "constants.DistContentDigestKey": {
"type": "object", "type": "object"
"description": "OK"
} }
} }
}, },
@ -684,8 +678,7 @@
}, },
"headers": { "headers": {
"cosntants.DistContentDigestKey": { "cosntants.DistContentDigestKey": {
"type": "object", "type": "object"
"description": "OK"
} }
} }
}, },
@ -704,6 +697,60 @@
} }
} }
}, },
"/v2/{name}/referrers/{digest}": {
"get": {
"description": "Get referrers given a digest",
"consumes": [
"application/json"
],
"produces": [
"application/vnd.oci.image.index.v1+json"
],
"summary": "Get referrers for a given digest",
"parameters": [
{
"type": "string",
"description": "repository name",
"name": "name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "digest",
"name": "digest",
"in": "path",
"required": true
},
{
"type": "string",
"description": "artifact type",
"name": "artifactType",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.ImageIndex"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal server error",
"schema": {
"type": "string"
}
}
}
}
},
"/v2/{name}/tags/list": { "/v2/{name}/tags/list": {
"get": { "get": {
"description": "List all image tags in a repository", "description": "List all image tags in a repository",
@ -762,10 +809,89 @@
}, },
"definitions": { "definitions": {
"api.ExtensionList": { "api.ExtensionList": {
"type": "object" "type": "object",
"properties": {
"extensions": {
"type": "array",
"items": {
"$ref": "#/definitions/extensions.Extension"
}
}
}
},
"api.ImageIndex": {
"type": "object",
"properties": {
"annotations": {
"description": "Annotations contains arbitrary metadata for the image index.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"manifests": {
"description": "Manifests references platform specific manifests.",
"type": "array",
"items": {
"$ref": "#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Descriptor"
}
},
"mediaType": {
"description": "MediaType specifies the type of this document data structure e.g. `application/vnd.oci.image.index.v1+json`",
"type": "string"
},
"schemaVersion": {
"description": "SchemaVersion is the image manifest schema that this image follows",
"type": "integer"
}
}
}, },
"api.ImageManifest": { "api.ImageManifest": {
"type": "object" "type": "object",
"properties": {
"annotations": {
"description": "Annotations contains arbitrary metadata for the image manifest.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"artifactType": {
"description": "ArtifactType specifies the IANA media type of artifact when the manifest is used for an artifact.",
"type": "string"
},
"config": {
"description": "Config references a configuration object for a container, by digest.\nThe referenced configuration object is a JSON blob that the runtime uses to set up the container.",
"allOf": [
{
"$ref": "#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Descriptor"
}
]
},
"layers": {
"description": "Layers is an indexed list of layers referenced by the manifest.",
"type": "array",
"items": {
"$ref": "#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Descriptor"
}
},
"mediaType": {
"description": "MediaType specifies the type of this document data structure e.g. `application/vnd.oci.image.manifest.v1+json`",
"type": "string"
},
"schemaVersion": {
"description": "SchemaVersion is the image manifest schema that this image follows",
"type": "integer"
},
"subject": {
"description": "Subject is an optional link from the image manifest to another manifest forming an association between the image manifest and the other manifest.",
"allOf": [
{
"$ref": "#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Descriptor"
}
]
}
}
}, },
"api.ImageTags": { "api.ImageTags": {
"type": "object", "type": "object",
@ -791,6 +917,104 @@
} }
} }
} }
},
"extensions.Extension": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"endpoints": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"github_com_opencontainers_image-spec_specs-go_v1.Descriptor": {
"type": "object",
"properties": {
"annotations": {
"description": "Annotations contains arbitrary metadata relating to the targeted content.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"artifactType": {
"description": "ArtifactType is the IANA media type of this artifact.",
"type": "string"
},
"data": {
"description": "Data is an embedding of the targeted content. This is encoded as a base64\nstring when marshalled to JSON (automatically, by encoding/json). If\npresent, Data can be used directly to avoid fetching the targeted content.",
"type": "array",
"items": {
"type": "integer"
}
},
"digest": {
"description": "Digest is the digest of the targeted content.",
"type": "string"
},
"mediaType": {
"description": "MediaType is the media type of the object this schema refers to.",
"type": "string"
},
"platform": {
"description": "Platform describes the platform which the image in the manifest runs on.\n\nThis should only be used when referring to a manifest.",
"allOf": [
{
"$ref": "#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Platform"
}
]
},
"size": {
"description": "Size specifies the size in bytes of the blob.",
"type": "integer"
},
"urls": {
"description": "URLs specifies a list of URLs from which this object MAY be downloaded",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"github_com_opencontainers_image-spec_specs-go_v1.Platform": {
"type": "object",
"properties": {
"architecture": {
"description": "Architecture field specifies the CPU architecture, for example\n`amd64` or `ppc64`.",
"type": "string"
},
"os": {
"description": "OS specifies the operating system, for example `linux` or `windows`.",
"type": "string"
},
"os.features": {
"description": "OSFeatures is an optional field specifying an array of strings,\neach listing a required OS feature (for example on Windows `win32k`).",
"type": "array",
"items": {
"type": "string"
}
},
"os.version": {
"description": "OSVersion is an optional field specifying the operating system\nversion, for example on Windows `10.0.14393.1066`.",
"type": "string"
},
"variant": {
"description": "Variant is an optional field specifying a variant of the CPU, for\nexample `v7` to specify ARMv7 when architecture is `arm`.",
"type": "string"
}
}
} }
} }
} }

View file

@ -1,7 +1,66 @@
definitions: definitions:
api.ExtensionList: api.ExtensionList:
properties:
extensions:
items:
$ref: '#/definitions/extensions.Extension'
type: array
type: object
api.ImageIndex:
properties:
annotations:
additionalProperties:
type: string
description: Annotations contains arbitrary metadata for the image index.
type: object
manifests:
description: Manifests references platform specific manifests.
items:
$ref: '#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Descriptor'
type: array
mediaType:
description: MediaType specifies the type of this document data structure
e.g. `application/vnd.oci.image.index.v1+json`
type: string
schemaVersion:
description: SchemaVersion is the image manifest schema that this image follows
type: integer
type: object type: object
api.ImageManifest: api.ImageManifest:
properties:
annotations:
additionalProperties:
type: string
description: Annotations contains arbitrary metadata for the image manifest.
type: object
artifactType:
description: ArtifactType specifies the IANA media type of artifact when the
manifest is used for an artifact.
type: string
config:
allOf:
- $ref: '#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Descriptor'
description: |-
Config references a configuration object for a container, by digest.
The referenced configuration object is a JSON blob that the runtime uses to set up the container.
layers:
description: Layers is an indexed list of layers referenced by the manifest.
items:
$ref: '#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Descriptor'
type: array
mediaType:
description: MediaType specifies the type of this document data structure
e.g. `application/vnd.oci.image.manifest.v1+json`
type: string
schemaVersion:
description: SchemaVersion is the image manifest schema that this image follows
type: integer
subject:
allOf:
- $ref: '#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Descriptor'
description: Subject is an optional link from the image manifest to another
manifest forming an association between the image manifest and the other
manifest.
type: object type: object
api.ImageTags: api.ImageTags:
properties: properties:
@ -19,11 +78,91 @@ definitions:
type: string type: string
type: array type: array
type: object type: object
extensions.Extension:
properties:
description:
type: string
endpoints:
items:
type: string
type: array
name:
type: string
url:
type: string
type: object
github_com_opencontainers_image-spec_specs-go_v1.Descriptor:
properties:
annotations:
additionalProperties:
type: string
description: Annotations contains arbitrary metadata relating to the targeted
content.
type: object
artifactType:
description: ArtifactType is the IANA media type of this artifact.
type: string
data:
description: |-
Data is an embedding of the targeted content. This is encoded as a base64
string when marshalled to JSON (automatically, by encoding/json). If
present, Data can be used directly to avoid fetching the targeted content.
items:
type: integer
type: array
digest:
description: Digest is the digest of the targeted content.
type: string
mediaType:
description: MediaType is the media type of the object this schema refers
to.
type: string
platform:
allOf:
- $ref: '#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Platform'
description: |-
Platform describes the platform which the image in the manifest runs on.
This should only be used when referring to a manifest.
size:
description: Size specifies the size in bytes of the blob.
type: integer
urls:
description: URLs specifies a list of URLs from which this object MAY be downloaded
items:
type: string
type: array
type: object
github_com_opencontainers_image-spec_specs-go_v1.Platform:
properties:
architecture:
description: |-
Architecture field specifies the CPU architecture, for example
`amd64` or `ppc64`.
type: string
os:
description: OS specifies the operating system, for example `linux` or `windows`.
type: string
os.features:
description: |-
OSFeatures is an optional field specifying an array of strings,
each listing a required OS feature (for example on Windows `win32k`).
items:
type: string
type: array
os.version:
description: |-
OSVersion is an optional field specifying the operating system
version, for example on Windows `10.0.14393.1066`.
type: string
variant:
description: |-
Variant is an optional field specifying a variant of the CPU, for
example `v7` to specify ARMv7 when architecture is `arm`.
type: string
type: object
info: info:
contact: contact: {}
email: support@swagger.io
name: API Support
url: http://www.swagger.io/support
description: APIs for Open Container Initiative Distribution Specification description: APIs for Open Container Initiative Distribution Specification
license: license:
name: Apache 2.0 name: Apache 2.0
@ -31,7 +170,7 @@ info:
title: Open Container Initiative Distribution Specification title: Open Container Initiative Distribution Specification
version: v1.1.0-dev version: v1.1.0-dev
paths: paths:
/oras/artifacts/v1/{name: /oras/artifacts/v1/{name}/manifests/{digest}/referrers:
get: get:
consumes: consumes:
- application/json - application/json
@ -180,7 +319,6 @@ paths:
description: OK description: OK
headers: headers:
constants.DistContentDigestKey: constants.DistContentDigestKey:
description: OK
type: object type: object
schema: schema:
$ref: '#/definitions/api.ImageManifest' $ref: '#/definitions/api.ImageManifest'
@ -410,7 +548,6 @@ paths:
description: OK description: OK
headers: headers:
constants.DistContentDigestKey: constants.DistContentDigestKey:
description: OK
type: object type: object
schema: schema:
$ref: '#/definitions/api.ImageManifest' $ref: '#/definitions/api.ImageManifest'
@ -445,7 +582,6 @@ paths:
description: ok description: ok
headers: headers:
cosntants.DistContentDigestKey: cosntants.DistContentDigestKey:
description: OK
type: object type: object
schema: schema:
type: string type: string
@ -493,6 +629,42 @@ paths:
schema: schema:
type: string type: string
summary: Update image manifest summary: Update image manifest
/v2/{name}/referrers/{digest}:
get:
consumes:
- application/json
description: Get referrers given a digest
parameters:
- description: repository name
in: path
name: name
required: true
type: string
- description: digest
in: path
name: digest
required: true
type: string
- description: artifact type
in: query
name: artifactType
type: string
produces:
- application/vnd.oci.image.index.v1+json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/api.ImageIndex'
"404":
description: not found
schema:
type: string
"500":
description: internal server error
schema:
type: string
summary: Get referrers for a given digest
/v2/{name}/tags/list: /v2/{name}/tags/list:
get: get:
consumes: consumes: