|
1 | | -# Extensions |
| 1 | +--- |
| 2 | +tags: oci,distribution |
| 3 | +breaks: false |
| 4 | +--- |
2 | 5 |
|
3 | | -The basis of the Extension API is described in a document which should be emulated for all extensions. |
| 6 | +# Extensions API for Distribution |
4 | 7 |
|
5 | | -## Table of Contents |
6 | | - |
7 | | -<!-- toc --> |
8 | | -* [Table](#table) |
9 | | -* [Name](#name) |
10 | | -* [Filename](#filename) |
11 | | -* [Detail](#detail) |
12 | | -* [Prior Art](#prior-art) |
13 | | -<!-- /toc --> |
| 8 | +The basis of the Extension API is described in a document which should |
| 9 | +be emulated for all extensions. |
14 | 10 |
|
15 | 11 | ## Table |
16 | 12 |
|
17 | 13 | _notice_: All new `./ext/ext-$name.md` docs MUST be added to this table. |
18 | 14 |
|
19 | | -| `$name` (and definition) | Summary | |
20 | | -|:--:|:--:| |
21 | | -| [0](./ext-0.md) | Extensions discovering extensions on registry server | |
22 | | -| | | |
23 | | - |
| 15 | +| `$name` | Summary | |
| 16 | +|:------------------------:|:----------------------------------------------------:| |
| 17 | +| [ext](./ext.md) | Extensions discovering extensions on registry server | |
24 | 18 |
|
25 | 19 | ## Name |
26 | 20 |
|
27 | | -Extension names MUST be unique. |
28 | | -Names SHOULD include a version. |
| 21 | +Extension names MUST be unique. Extensions are specified by |
| 22 | +`namespace` aligning with the project, followed by the `extension` provided by the project and last by by the `component`. This constitues the URI segments |
| 23 | +of the extension endpoint. Additional options may be passed as parameters to the endpoint. |
| 24 | + |
| 25 | +```http |
| 26 | +_<ns>/<ext>/<component>[?<key>=<value>&...] |
| 27 | +``` |
| 28 | + |
| 29 | +For versioning, extensions SHOULD use versioned `mediaType`. |
| 30 | + |
| 31 | +### Registry Level Extensions |
29 | 32 |
|
30 | | -Each extension's endpoints will be nested below its name. |
| 33 | +Registry level extensions are nested under `/v2`. |
31 | 34 |
|
32 | | -```HTTP |
33 | | - GET /v2/ext/0/... |
| 35 | +```http |
| 36 | +GET /v2/_<ns>/<ext>/<component>[?<key>=<value>&...] |
| 37 | +``` |
| 38 | + |
| 39 | +For example a search extension may be of the form `/v2/_oci/catalog/search?pattern=foo?n=10` |
| 40 | + |
| 41 | +### Repository Level Extensions |
| 42 | + |
| 43 | +Repository level extensions follow the same naming rules the endpoints |
| 44 | +can be access under a repository. |
| 45 | + |
| 46 | +```http |
| 47 | +GET /v2/<name>/_<ns>/<ext>/<component>[?<key>=<value>&...] |
34 | 48 | ``` |
35 | 49 |
|
36 | 50 | ## Filename |
37 | 51 |
|
38 | | -XXX |
| 52 | +Extention definitions SHOULD be placed under `./ext/`. Extension files |
| 53 | +SHOULD follow the `ext-$name.md`. Refer [ext.md](./ext.md) for more details. |
39 | 54 |
|
40 | 55 | ## Detail |
41 | 56 |
|
42 | | -XXX acceptable error codes |
| 57 | +Extensions details MAY describe more endpoints and APIs that it MAY support. |
| 58 | +It is also recommended to call out error codes encountered and enumerated as in the |
| 59 | +in the following table: |
| 60 | + |
| 61 | +| Code | Message | Description | |
| 62 | +|---------------------|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 63 | +| `EXTENSION_UNKNOWN` | Extension is unknown | This error MAY be returned when a extension is unknown to the registry in a specified repository. This can be returned with a standard get or if a manifest references an unknown layer during upload. | |
| 64 | + |
| 65 | +## Pagination |
| 66 | + |
| 67 | +Extensions implementing pagination and SHOULD align with the |
| 68 | +[pagination](./spec.md#pagination) specification. |
| 69 | + |
| 70 | +Extension MAY provide enumeration without lexical ordering and in this case, |
| 71 | +it is not required to support the `last` parameter. Clients are NOT RECOMMENDED to construct the `link` and SHOULD treat the URL as opaque. |
43 | 72 |
|
44 | 73 | ## Prior Art |
45 | 74 |
|
|
0 commit comments