"/accessories"-API should return actual OCI 1.1 artifactType
of the artifactΒ #21344
Description
Is your feature request related to a problem? Please describe.
When listing the accessories of an artifact by using the /accessories
endpoint of the API, the results currently do not contain the actual artifactType
of the artifact as specified by the OCI 1.1 image spec. The Accessory
model used by Harbor has a type
attribute, but the value can only be one of a few predefined constants, severely limiting its usefulness.
Describe the solution you'd like
Instead of the fallback subject.accessory
type, I would like to see the actual artifactType
as returned by the Referrers-API as the accessory type. Since this would be a (slightly) breaking change, as an alternative we could add a new artifact_type
attribute to the Accessory
model.
Also, it should be possible to query only the artifacts of a specific artifactType
. Since Harbor v2.12 there is a new endpoint to query all artifacts of a project that have a given artifact_type
, but this only works for the whole project, not when listing the accessories of a given repository. For this, I currently have to query the Referrer-API directly:
curl 'https://localhost/v2/{project}/{repo}/referrers/{digest}?artifactType=example/artifact-type'
In summary:
- The
/accessories
endpoint should return the actualartifactType
of the OCI 1.1 artifact. - The
/accessories
endpoint should support to query by a specificartifactType
.