<?xml version="1.0" encoding="UTF-8"?>
<spec xmlns="https://vibevm.org/spec/1">
  <title>Annotations</title>
  <p p="1">Several components of the specification, like [Image Manifests](manifest.md) and [Descriptors](descriptor.md), feature an optional annotations property, whose format is common and defined in this section.</p>
  <p p="2">This property contains arbitrary metadata.</p>
  <section title="Rules">
    <list ordered="false" p="3">
      <item>Annotations MUST be a key-value map where both the key and value MUST be strings.</item>
      <item>While the value MUST be present, it MAY be an empty string.</item>
      <item>Keys MUST be unique within this map, and best practice is to namespace the keys.</item>
      <item>Keys SHOULD be named using a reverse domain notation - e.g. `com.example.myKey`.</item>
      <item>The prefix `org.opencontainers` is reserved for keys defined in Open Container Initiative (OCI) specifications and MUST NOT be used by other specifications and extensions.</item>
      <item>Keys using the `org.opencontainers.image` namespace are reserved for use in the OCI Image Specification and MUST NOT be used by other specifications and extensions, including other OCI specifications.</item>
      <item>If there are no annotations then this property MUST either be absent or be an empty map.</item>
      <item>Consumers MUST NOT generate an error if they encounter an unknown annotation key.</item>
    </list>
  </section>
  <section title="Pre-Defined Annotation Keys">
    <p p="4">This specification defines the following annotation keys, intended for but not limited to [image index](image-index.md), image [manifest](manifest.md), and [descriptor](descriptor.md) authors.</p>
    <list ordered="false" p="5">
      <item>**org.opencontainers.image.created** date and time on which the image was built, conforming to [RFC 3339][rfc3339].</item>
      <item>**org.opencontainers.image.authors** contact details of the people or organization responsible for the image (freeform string)</item>
      <item>**org.opencontainers.image.url** URL to find more information on the image (string)</item>
      <item>**org.opencontainers.image.documentation** URL to get documentation on the image (string)</item>
      <item>**org.opencontainers.image.source** URL to get source code for building the image (string)</item>
      <item>**org.opencontainers.image.version** version of the packaged software</item>
      <item>The version MAY match a label or tag in the source code repository</item>
      <item>version MAY be [Semantic versioning-compatible](https://semver.org/)</item>
      <item>**org.opencontainers.image.revision** Source control revision identifier for the packaged software.</item>
      <item>**org.opencontainers.image.vendor** Name of the distributing entity, organization or individual.</item>
      <item>**org.opencontainers.image.licenses** License(s) under which contained software is distributed as an [SPDX License Expression][spdx-license-expression].</item>
      <item>**org.opencontainers.image.ref.name** Name of the reference for a target (string).</item>
      <item>SHOULD only be considered valid when on descriptors on `index.json` within [image layout](image-layout.md).</item>
      <item>Character set of the value SHOULD conform to alphanum of `A-Za-z0-9` and separator set of `-._:@/+`</item>
      <item>A valid reference matches the following [grammar](considerations.md#ebnf):</item>
    </list>
    <fence lang="ebnf" p="6">    ref       ::= component ("/" component)*
    component ::= alphanum (separator alphanum)*
    alphanum  ::= [A-Za-z0-9]+
    separator ::= [-._:@+] | "--"</fence>
    <list ordered="false" p="7">
      <item>**org.opencontainers.image.title** Human-readable title of the image (string)</item>
      <item>**org.opencontainers.image.description** Human-readable description of the software packaged in the image (string)</item>
      <item>**org.opencontainers.image.base.digest** [Digest](descriptor.md#digests) of the image this image is based on (string)</item>
      <item>This SHOULD be the immediate image sharing zero-indexed layers with the image, such as from a Dockerfile `FROM` statement.</item>
      <item>This SHOULD NOT reference any other images used to generate the contents of the image (e.g., multi-stage Dockerfile builds).</item>
      <item>**org.opencontainers.image.base.name** Image reference of the image this image is based on (string)</item>
      <item>This SHOULD be image references in the format defined by [distribution/distribution][distribution-reference].</item>
      <item>This SHOULD be a fully qualified reference name, without any assumed default registry. (e.g., `registry.example.com/my-org/my-image:tag` instead of `my-org/my-image:tag`).</item>
      <item>This SHOULD be the immediate image sharing zero-indexed layers with the image, such as from a Dockerfile `FROM` statement.</item>
      <item>This SHOULD NOT reference any other images used to generate the contents of the image (e.g., multi-stage Dockerfile builds).</item>
      <item>If the `image.base.name` annotation is specified, the `image.base.digest` annotation SHOULD be the digest of the manifest referenced by the `image.ref.name` annotation.</item>
    </list>
  </section>
  <section title="Back-compatibility with Label Schema">
    <p p="8">[Label Schema][label-schema] defined a number of conventional labels for container images, and these are now superseded by annotations with keys starting **org.opencontainers.image**.</p>
    <p p="9">While users are encouraged to use the **org.opencontainers.image** keys, tools MAY choose to support compatible annotations using the **org.label-schema** prefix as follows.</p>
    <table p="10">
      <tr>
        <td>`org.opencontainers.image` prefix</td>
        <td>`org.label-schema` prefix</td>
        <td>Compatibility notes</td>
      </tr>
      <tr>
        <td>`created`</td>
        <td>`build-date`</td>
        <td>Compatible</td>
      </tr>
      <tr>
        <td>`url`</td>
        <td>`url`</td>
        <td>Compatible</td>
      </tr>
      <tr>
        <td>`source`</td>
        <td>`vcs-url`</td>
        <td>Compatible</td>
      </tr>
      <tr>
        <td>`version`</td>
        <td>`version`</td>
        <td>Compatible</td>
      </tr>
      <tr>
        <td>`revision`</td>
        <td>`vcs-ref`</td>
        <td>Compatible</td>
      </tr>
      <tr>
        <td>`vendor`</td>
        <td>`vendor`</td>
        <td>Compatible</td>
      </tr>
      <tr>
        <td>`title`</td>
        <td>`name`</td>
        <td>Compatible</td>
      </tr>
      <tr>
        <td>`description`</td>
        <td>`description`</td>
        <td>Compatible</td>
      </tr>
      <tr>
        <td>`documentation`</td>
        <td>`usage`</td>
        <td>Value is compatible if the documentation is located by a URL</td>
      </tr>
      <tr>
        <td>`authors`</td>
        <td></td>
        <td>No equivalent in Label Schema</td>
      </tr>
      <tr>
        <td>`licenses`</td>
        <td></td>
        <td>No equivalent in Label Schema</td>
      </tr>
      <tr>
        <td>`ref.name`</td>
        <td></td>
        <td>No equivalent in Label Schema</td>
      </tr>
      <tr>
        <td></td>
        <td>`schema-version`</td>
        <td>No equivalent in the OCI Image Spec</td>
      </tr>
      <tr>
        <td></td>
        <td>`docker.*`, `rkt.*`</td>
        <td>No equivalent in the OCI Image Spec</td>
      </tr>
    </table>
    <p p="11">[distribution-reference]: https://github.com/distribution/distribution/blob/d0deff9cd6c2b8c82c6f3d1c713af51df099d07b/reference/reference.go
[label-schema]: https://github.com/label-schema/label-schema.org/blob/gh-pages/rc1.md
[rfc3339]:     https://tools.ietf.org/html/rfc3339#section-5.6
[spdx-license-expression]: https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/</p>
  </section>
</spec>
