fix: referrers now appears in swagger generated docs (#1488)
Signed-off-by: Lisca Ana-Roberta <ana.kagome@yahoo.com>
This commit is contained in:
parent
4d6ca493f2
commit
622dde9193
4
Makefile
4
Makefile
@ -25,7 +25,7 @@ CRICTL_VERSION := v1.26.1
|
||||
ACTION_VALIDATOR := $(TOOLSDIR)/bin/action-validator
|
||||
ACTION_VALIDATOR_VERSION := v0.2.1
|
||||
ZUI_VERSION := commit-05d5f74
|
||||
SWAGGER_VERSION := 1.8.12
|
||||
SWAGGER_VERSION := v1.8.12
|
||||
STACKER := $(TOOLSDIR)/bin/stacker
|
||||
BATS := $(TOOLSDIR)/bin/bats
|
||||
TESTDATA := $(TOP_LEVEL)/test/data
|
||||
@ -205,7 +205,7 @@ check: ./golangcilint.yaml $(GOLINTER)
|
||||
|
||||
swagger/docs.go:
|
||||
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
|
||||
swagger: swagger/docs.go pkg/api/routes.go
|
||||
|
1
go.mod
1
go.mod
@ -5,7 +5,6 @@ go 1.20
|
||||
require (
|
||||
github.com/99designs/gqlgen v0.17.31
|
||||
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/aquasecurity/trivy-db v0.0.0-20230515061101-378ab9ed302c
|
||||
github.com/bmatcuk/doublestar/v4 v4.6.0
|
||||
|
2
go.sum
2
go.sum
@ -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/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-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/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=
|
||||
|
@ -509,16 +509,17 @@ func getReferrers(routeHandler *RouteHandler,
|
||||
}
|
||||
|
||||
// GetReferrers godoc
|
||||
// @Summary Get references for a given digest
|
||||
// @Description Get references given a digest
|
||||
// @Summary Get referrers for a given digest
|
||||
// @Description Get referrers given a digest
|
||||
// @Accept json
|
||||
// @Produce application/vnd.oci.image.index.v1+json
|
||||
// @Param name path string true "repository name"
|
||||
// @Param digest path string true "digest"
|
||||
// @Param artifactType query string false "artifact type"
|
||||
// @Success 200 {object} api.ImageIndex
|
||||
// @Failure 404 {string} string "not found"
|
||||
// @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) {
|
||||
response.Header().Set("Access-Control-Allow-Methods", "HEAD,GET,POST,OPTIONS")
|
||||
response.Header().Set("Access-Control-Allow-Headers", "Authorization,content-type")
|
||||
@ -1798,7 +1799,7 @@ type ReferenceList struct {
|
||||
// @Success 200 {string} string "ok"
|
||||
// @Failure 404 {string} string "not found"
|
||||
// @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) {
|
||||
vars := mux.Vars(request)
|
||||
name, ok := vars["name"]
|
||||
|
326
swagger/docs.go
326
swagger/docs.go
@ -1,29 +1,16 @@
|
||||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// This file was generated by swaggo/swag at
|
||||
// 2022-05-20 22:28:21.990630149 +0000 UTC m=+0.151110280
|
||||
// Code generated by swaggo/swag. DO NOT EDIT.
|
||||
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
import "github.com/swaggo/swag"
|
||||
|
||||
"github.com/alecthomas/template"
|
||||
"github.com/swaggo/swag"
|
||||
)
|
||||
|
||||
var doc = `{
|
||||
const docTemplate = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{.Description}}",
|
||||
"description": "{{escape .Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"contact": {
|
||||
"name": "API Support",
|
||||
"url": "http://www.swagger.io/support",
|
||||
"email": "support@swagger.io"
|
||||
},
|
||||
"contact": {},
|
||||
"license": {
|
||||
"name": "Apache 2.0",
|
||||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||
@ -33,7 +20,7 @@ var doc = `{
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/oras/artifacts/v1/{name}": {
|
||||
"/oras/artifacts/v1/{name}/manifests/{digest}/referrers": {
|
||||
"get": {
|
||||
"description": "Get references for an image given a digest and artifact type",
|
||||
"consumes": [
|
||||
@ -389,7 +376,7 @@ var doc = `{
|
||||
},
|
||||
"Range": {
|
||||
"type": "string",
|
||||
"description": "bytes=0-128"
|
||||
"description": "0-128"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -522,8 +509,7 @@ var doc = `{
|
||||
},
|
||||
"headers": {
|
||||
"constants.DistContentDigestKey": {
|
||||
"type": "object",
|
||||
"description": "OK"
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -564,8 +550,7 @@ var doc = `{
|
||||
},
|
||||
"headers": {
|
||||
"constants.DistContentDigestKey": {
|
||||
"type": "object",
|
||||
"description": "OK"
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -702,8 +687,7 @@ var doc = `{
|
||||
},
|
||||
"headers": {
|
||||
"cosntants.DistContentDigestKey": {
|
||||
"type": "object",
|
||||
"description": "OK"
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -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": {
|
||||
"get": {
|
||||
"description": "List all image tags in a repository",
|
||||
@ -780,10 +818,89 @@ var doc = `{
|
||||
},
|
||||
"definitions": {
|
||||
"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": {
|
||||
"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": {
|
||||
"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
|
||||
var SwaggerInfo = swaggerInfo{
|
||||
Version: "v1.1.0-dev",
|
||||
Host: "",
|
||||
BasePath: "",
|
||||
Schemes: []string{},
|
||||
Title: "Open Container Initiative Distribution Specification",
|
||||
Description: "APIs for Open Container Initiative Distribution Specification",
|
||||
}
|
||||
|
||||
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()
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "v1.1.0-dev",
|
||||
Host: "",
|
||||
BasePath: "",
|
||||
Schemes: []string{},
|
||||
Title: "Open Container Initiative Distribution Specification",
|
||||
Description: "APIs for Open Container Initiative Distribution Specification",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(swag.Name, &s{})
|
||||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
func TestDocs(t *testing.T) {
|
||||
Convey("Read docs", t, func() {
|
||||
s := swagger.New()
|
||||
s := swagger.SwaggerInfo
|
||||
So(s.ReadDoc(), ShouldNotBeEmpty)
|
||||
})
|
||||
}
|
||||
|
@ -3,11 +3,7 @@
|
||||
"info": {
|
||||
"description": "APIs for Open Container Initiative Distribution Specification",
|
||||
"title": "Open Container Initiative Distribution Specification",
|
||||
"contact": {
|
||||
"name": "API Support",
|
||||
"url": "http://www.swagger.io/support",
|
||||
"email": "support@swagger.io"
|
||||
},
|
||||
"contact": {},
|
||||
"license": {
|
||||
"name": "Apache 2.0",
|
||||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||
@ -15,7 +11,7 @@
|
||||
"version": "v1.1.0-dev"
|
||||
},
|
||||
"paths": {
|
||||
"/oras/artifacts/v1/{name": {
|
||||
"/oras/artifacts/v1/{name}/manifests/{digest}/referrers": {
|
||||
"get": {
|
||||
"description": "Get references for an image given a digest and artifact type",
|
||||
"consumes": [
|
||||
@ -504,8 +500,7 @@
|
||||
},
|
||||
"headers": {
|
||||
"constants.DistContentDigestKey": {
|
||||
"type": "object",
|
||||
"description": "OK"
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -546,8 +541,7 @@
|
||||
},
|
||||
"headers": {
|
||||
"constants.DistContentDigestKey": {
|
||||
"type": "object",
|
||||
"description": "OK"
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -684,8 +678,7 @@
|
||||
},
|
||||
"headers": {
|
||||
"cosntants.DistContentDigestKey": {
|
||||
"type": "object",
|
||||
"description": "OK"
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -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": {
|
||||
"get": {
|
||||
"description": "List all image tags in a repository",
|
||||
@ -762,10 +809,89 @@
|
||||
},
|
||||
"definitions": {
|
||||
"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": {
|
||||
"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": {
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,66 @@
|
||||
definitions:
|
||||
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
|
||||
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
|
||||
api.ImageTags:
|
||||
properties:
|
||||
@ -19,11 +78,91 @@ definitions:
|
||||
type: string
|
||||
type: array
|
||||
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:
|
||||
contact:
|
||||
email: support@swagger.io
|
||||
name: API Support
|
||||
url: http://www.swagger.io/support
|
||||
contact: {}
|
||||
description: APIs for Open Container Initiative Distribution Specification
|
||||
license:
|
||||
name: Apache 2.0
|
||||
@ -31,7 +170,7 @@ info:
|
||||
title: Open Container Initiative Distribution Specification
|
||||
version: v1.1.0-dev
|
||||
paths:
|
||||
/oras/artifacts/v1/{name:
|
||||
/oras/artifacts/v1/{name}/manifests/{digest}/referrers:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
@ -180,7 +319,6 @@ paths:
|
||||
description: OK
|
||||
headers:
|
||||
constants.DistContentDigestKey:
|
||||
description: OK
|
||||
type: object
|
||||
schema:
|
||||
$ref: '#/definitions/api.ImageManifest'
|
||||
@ -410,7 +548,6 @@ paths:
|
||||
description: OK
|
||||
headers:
|
||||
constants.DistContentDigestKey:
|
||||
description: OK
|
||||
type: object
|
||||
schema:
|
||||
$ref: '#/definitions/api.ImageManifest'
|
||||
@ -445,7 +582,6 @@ paths:
|
||||
description: ok
|
||||
headers:
|
||||
cosntants.DistContentDigestKey:
|
||||
description: OK
|
||||
type: object
|
||||
schema:
|
||||
type: string
|
||||
@ -493,6 +629,42 @@ paths:
|
||||
schema:
|
||||
type: string
|
||||
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:
|
||||
get:
|
||||
consumes:
|
||||
|
Loading…
Reference in New Issue
Block a user