diff --git a/pkg/api/routes.go b/pkg/api/routes.go index 55e009be..d4c24e4a 100644 --- a/pkg/api/routes.go +++ b/pkg/api/routes.go @@ -30,6 +30,7 @@ import ( jsoniter "github.com/json-iterator/go" "github.com/opencontainers/distribution-spec/specs-go/v1/extensions" godigest "github.com/opencontainers/go-digest" + specs "github.com/opencontainers/image-spec/specs-go" ispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/zitadel/oidc/v3/pkg/client/rp" "github.com/zitadel/oidc/v3/pkg/oidc" @@ -499,7 +500,13 @@ func (rh *RouteHandler) CheckManifest(response http.ResponseWriter, request *htt } type ImageManifest struct { - ispec.Manifest + specs.Versioned + MediaType string `json:"mediaType,omitempty"` + ArtifactType string `json:"artifactType,omitempty"` + Config ImageDescriptor `json:"config"` + Layers []ImageDescriptor `json:"layers"` + Subject *ImageDescriptor `json:"subject,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` } type ExtensionList struct { @@ -587,7 +594,23 @@ func (rh *RouteHandler) GetManifest(response http.ResponseWriter, request *http. } type ImageIndex struct { - ispec.Index + specs.Versioned + MediaType string `json:"mediaType,omitempty"` + ArtifactType string `json:"artifactType,omitempty"` + Manifests []ImageDescriptor `json:"manifests"` + Subject *ImageDescriptor `json:"subject,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` +} + +type ImageDescriptor struct { + MediaType string `json:"mediaType"` + Digest string `json:"digest"` + Size int64 `json:"size"` + URLs []string `json:"urls,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` + Data []byte `json:"data,omitempty"` + Platform *ispec.Platform `json:"platform,omitempty"` + ArtifactType string `json:"artifactType,omitempty"` } func getReferrers(ctx context.Context, routeHandler *RouteHandler, diff --git a/swagger/docs.go b/swagger/docs.go index 05b8c126..985f5a09 100644 --- a/swagger/docs.go +++ b/swagger/docs.go @@ -1239,29 +1239,63 @@ const docTemplate = `{ } } }, - "api.ImageIndex": { + "api.ImageDescriptor": { + "type": "object", + "properties": { + "annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "artifactType": { + "type": "string" + }, + "data": { + "type": "array", + "items": { + "type": "integer" + } + }, + "digest": { + "type": "string" + }, + "mediaType": { + "type": "string" + }, + "platform": { + "$ref": "#/definitions/v1.Platform" + }, + "size": { + "type": "integer" + }, + "urls": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "api.ImageIndex": { "type": "object", "properties": { "annotations": { - "description": "Annotations contains arbitrary metadata for the image index.", "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" }, "manifests": { - "description": "Manifests references platform specific manifests.", "type": "array", "items": { - "$ref": "#/definitions/v1.Descriptor" + "$ref": "#/definitions/api.ImageDescriptor" } }, "mediaType": { - "description": "MediaType specifies the type of this document data structure e.g. ` + "`" + `application/vnd.oci.image.index.v1+json` + "`" + `", "type": "string" }, "schemaVersion": { @@ -1269,12 +1303,7 @@ const docTemplate = `{ "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/v1.Descriptor" - } - ] + "$ref": "#/definitions/api.ImageDescriptor" } } }, @@ -1282,33 +1311,24 @@ const docTemplate = `{ "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/v1.Descriptor" - } - ] + "$ref": "#/definitions/api.ImageDescriptor" }, "layers": { - "description": "Layers is an indexed list of layers referenced by the manifest.", "type": "array", "items": { - "$ref": "#/definitions/v1.Descriptor" + "$ref": "#/definitions/api.ImageDescriptor" } }, "mediaType": { - "description": "MediaType specifies the type of this document data structure e.g. ` + "`" + `application/vnd.oci.image.manifest.v1+json` + "`" + `", "type": "string" }, "schemaVersion": { @@ -1316,12 +1336,7 @@ const docTemplate = `{ "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/v1.Descriptor" - } - ] + "$ref": "#/definitions/api.ImageDescriptor" } } }, @@ -1466,56 +1481,6 @@ const docTemplate = `{ } } }, - "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/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" - } - } - } - }, "v1.Platform": { "type": "object", "properties": { diff --git a/swagger/swagger.json b/swagger/swagger.json index 699782ef..802b02d0 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -1231,29 +1231,63 @@ } } }, - "api.ImageIndex": { + "api.ImageDescriptor": { + "type": "object", + "properties": { + "annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "artifactType": { + "type": "string" + }, + "data": { + "type": "array", + "items": { + "type": "integer" + } + }, + "digest": { + "type": "string" + }, + "mediaType": { + "type": "string" + }, + "platform": { + "$ref": "#/definitions/v1.Platform" + }, + "size": { + "type": "integer" + }, + "urls": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "api.ImageIndex": { "type": "object", "properties": { "annotations": { - "description": "Annotations contains arbitrary metadata for the image index.", "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" }, "manifests": { - "description": "Manifests references platform specific manifests.", "type": "array", "items": { - "$ref": "#/definitions/v1.Descriptor" + "$ref": "#/definitions/api.ImageDescriptor" } }, "mediaType": { - "description": "MediaType specifies the type of this document data structure e.g. `application/vnd.oci.image.index.v1+json`", "type": "string" }, "schemaVersion": { @@ -1261,12 +1295,7 @@ "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/v1.Descriptor" - } - ] + "$ref": "#/definitions/api.ImageDescriptor" } } }, @@ -1274,33 +1303,24 @@ "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/v1.Descriptor" - } - ] + "$ref": "#/definitions/api.ImageDescriptor" }, "layers": { - "description": "Layers is an indexed list of layers referenced by the manifest.", "type": "array", "items": { - "$ref": "#/definitions/v1.Descriptor" + "$ref": "#/definitions/api.ImageDescriptor" } }, "mediaType": { - "description": "MediaType specifies the type of this document data structure e.g. `application/vnd.oci.image.manifest.v1+json`", "type": "string" }, "schemaVersion": { @@ -1308,12 +1328,7 @@ "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/v1.Descriptor" - } - ] + "$ref": "#/definitions/api.ImageDescriptor" } } }, @@ -1458,56 +1473,6 @@ } } }, - "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/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" - } - } - } - }, "v1.Platform": { "type": "object", "properties": { diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index cd236e3e..c16e8b0d 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -17,71 +17,72 @@ definitions: $ref: '#/definitions/extensions.Extension' type: array type: object + api.ImageDescriptor: + properties: + annotations: + additionalProperties: + type: string + type: object + artifactType: + type: string + data: + items: + type: integer + type: array + digest: + type: string + mediaType: + type: string + platform: + $ref: '#/definitions/v1.Platform' + size: + type: integer + urls: + items: + type: string + type: array + type: object api.ImageIndex: properties: annotations: additionalProperties: type: string - description: Annotations contains arbitrary metadata for the image index. type: object artifactType: - description: ArtifactType specifies the IANA media type of artifact when the - manifest is used for an artifact. type: string manifests: - description: Manifests references platform specific manifests. items: - $ref: '#/definitions/v1.Descriptor' + $ref: '#/definitions/api.ImageDescriptor' 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 subject: - allOf: - - $ref: '#/definitions/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. + $ref: '#/definitions/api.ImageDescriptor' 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/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. + $ref: '#/definitions/api.ImageDescriptor' layers: - description: Layers is an indexed list of layers referenced by the manifest. items: - $ref: '#/definitions/v1.Descriptor' + $ref: '#/definitions/api.ImageDescriptor' 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/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. + $ref: '#/definitions/api.ImageDescriptor' type: object api.LogoutResponse: properties: @@ -173,48 +174,6 @@ definitions: releaseTag: type: string type: object - 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/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 v1.Platform: properties: architecture: