-
Notifications
You must be signed in to change notification settings - Fork 1
New capabilities endpoint spec #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| --- | ||
| title: Get capabilities | ||
| description: An endpoint for querying server capabilities | ||
| next: false | ||
| sidebar: | ||
| order: 2 | ||
| --- | ||
|
|
||
| import CoreAction from "@partials/_core-action.mdx"; | ||
|
|
||
| <CoreAction /> | ||
|
|
||
| ```http title="Endpoint" | ||
| GET /v1/capabilities | ||
| ``` | ||
|
|
||
| The capabilities endpoint exposes details about the features a server supports. Capabilities are scoped by `urn` and MUST contain the following: | ||
|
|
||
| - Each supported version of the feature. | ||
| - The `status` of the feature version: `STABLE` | `UNSTABLE` | `DEPRECATED`. | ||
| - The `root` relative URL the feature can be accessed at. | ||
|
|
||
| Each `capabilities` response MUST contain a `urn:opa:core` object that lists the versions of the Open Podcast API the server supports. Additional capabilities MAY be returned as separate `urn` objects with supported versions. | ||
|
|
||
| ## Example 200 response | ||
|
|
||
| ```json | ||
| { | ||
| "urn:opa:core": { | ||
| "0.0.1": { | ||
| "status": "DEPRECATED", | ||
| "root": "/v0" | ||
| }, | ||
| "1.0.0": { | ||
| "status": "STABLE", | ||
| "root": "/v1" | ||
| }, | ||
| "2.0.0": { | ||
| "status": "UNSTABLE", | ||
| "root": "/v2" | ||
| } | ||
| }, | ||
| "urn:opa:extra:playcount": { | ||
| "0.0.1": { | ||
| "status": "DEPRECATED", | ||
| "root": "/v0/playcount" | ||
| }, | ||
| "1.0.0": { | ||
| "status": "STABLE", | ||
| "root": "/v1/playcount" | ||
| }, | ||
| "2.0.0": { | ||
| "status": "UNSTABLE", | ||
| "root": "/v2/playcount" | ||
| } | ||
| } | ||
| } | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| --- | ||
| title: Capabilities endpoint | ||
| description: An endpoint for querying server capabilities | ||
| prev: false | ||
| sidebar: | ||
| label: Overview | ||
| order: 1 | ||
| --- | ||
|
|
||
| import CoreEndpoint from "@partials/_core-endpoint.mdx"; | ||
|
|
||
| <CoreEndpoint /> | ||
|
|
||
| The Open Podcast API is subject to change over time. To ensure backwards compatibility and effective communication of server capabilities, the API specification MUST be versioned in a consistent way. | ||
|
|
||
| The specification follows the [Semantic versioning model](https://semver.org/). Each version of the specification MUST adhere to the following rules: | ||
|
|
||
| **Major** versions | ||
| : A major version update indicates that a breaking change has occurred. This is reserved for the deprecation, addition, or renaming of **core** capabilities. | ||
|
|
||
| **Minor** versions | ||
| : A minor version update indicates that a new **optional** feature has been added or that a **core** feature has received a non-breaking change. This can include the deprecation or addition of parameters or behaviors. | ||
|
|
||
| **Patch** versions | ||
| : A patch version update indicates that a small non-breaking change has been made to clarify a feature or address an issue with wording. | ||
|
|
||
| ## Backwards compatibility | ||
|
|
||
| To maintain backwards compatibility between **minor** versions, no parameters nor endpoints may be removed without a **major** version change. Fields may be deprecated in favor of new behaviors, but when queried by an older client the server MUST respond with a compatible response. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sorry, I have not read the existing spec. Is there a mechanism for servers to know if they're dealing with an older client? That would be nice so people developing new clients don't accidebtally use deprecated request/response fields.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jfly In general, the idea is that server developers should scope their implementation to a specific root. This means that if they support version 1.0.0 and version 2.0.0, they should put these on different roots (e.g. The current approach doesn't programatically filter anything out, and I'm wondering if HATEOAS would be a good approach here for exposing this information in a more structured way. We could update this endpoint to require support for query parameters indicating the maximum and minimum versions of the core spec a client supports. That way, the client can ask the server if its capabilities are supported and use the latest supported version if so, but if not the client can report back. For example:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My initial reaction is that this is puts complexity in 2 places:
Would it be better to put all the logic in the client: just request |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "first object" reads strangely.
"urn:opa:core"is a string, not an object. Furthermore,capabilitiesis an object, not a list. I've never seen a JSON api which makes any promises/requirements about the order of keys in an object. I wouldn't be surprised if there are programming languages with popular JSON libraries which do not preserve the order of keys in a JSON object.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jfly Good point, it'll be directly destructured either way so position isn't important. I'll update that.