-
Notifications
You must be signed in to change notification settings - Fork 890
Resource Versioning Profile #1333
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: gh-pages
Are you sure you want to change the base?
Changes from 1 commit
df9838a
e815ccd
c302a8c
84d4840
ea9c13c
9d9e263
9368cbc
d3c1d13
cac4baf
56bc05e
75659ce
2d5346e
c351d9c
3e4b67e
515aba9
0feddd6
b0a1e3d
f0d73db
a4329d5
7a352dc
9129eb2
ba9bf0b
6bc95be
1a1395d
e4adbd7
5c5b0f4
c82ecbe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,96 @@ object that includes a `type` link to | |
If a server is able to process the version argument but an appropriate version | ||
cannot be located, the server **MUST** respond with a `404 Not Found`. | ||
|
||
# Links | ||
|
||
When a server processes a request with a `resource_version` query parameter and | ||
a `self` link is provided for a top-level links object, the link's `href` | ||
**MUST** include the `resource_version` query parameter with the same version | ||
identifier that was requested. | ||
|
||
When a server processes a request with a `resource_version` query parameter and | ||
all resource object `self` links **SHOULD** contain a `resource_version` query | ||
parameter which identifies the specific revision represented by that resource | ||
object. | ||
|
||
For example, in the following response document the `self` links are not the | ||
same: | ||
|
||
```json | ||
{ | ||
"data": { | ||
"type": "article", | ||
"id": 1, | ||
"links": { | ||
"self": "/article/1?resource_version=id:42" | ||
} | ||
}, | ||
"links": { | ||
"self": "/article/1?resource_version=rel:latest-version" | ||
} | ||
} | ||
``` | ||
|
||
A server **MAY** provide a `version-history` link in a resource object's links | ||
gabesullice marked this conversation as resolved.
Show resolved
Hide resolved
|
||
object. This link must reference a collection resource providing all revisions | ||
of the context resource object. | ||
|
||
A server **MAY** provide the following resource object links so that a client may | ||
navigate a resource object's version history: | ||
|
||
- `latest-version`: links to the latest version of the context resource | ||
object. | ||
- `working-copy`: links to the working copy of the context resource object. | ||
- `predecessor-version`: links to the version which immediately preceded the | ||
context resource object. | ||
- `successor-version`: links to the version which immediately succeeded the | ||
context resource object. | ||
- `prior-working-copy`: links to the working copy which immediately preceded | ||
the context resource object. | ||
- `subsequent-working-copy`: links to the working copy which immediately | ||
preceded the context resource object. | ||
|
||
A server **MAY** provide an array of any of these links to support branching. | ||
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. @ethanresnick, this is in conflict with the base spec. Not sure what to do or how to accommodate this in any other way. Perhaps you have some ideas? 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. @gabesullice I'd be happy to just define these links in the base spec as a temporary workaround. Note also that the base spec's current approach is that, if an array of links is allowed, an array should be required (like we did for So, the base spec language would go under the resource links section, and could say something like:
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. That'd be great :) 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. bump. 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. @ethanresnick Rather than calling out those 4 specific link relations, perhaps it'd be better to generalize that to something like:
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. While I agree that calling out specific link relations "smells" a bit, I would not like to see the concept of links object keys as link relations furthered in the spec. Links can have more than one link relation and this pattern makes that more challenging to fix in later iterations of the spec. |
||
|
||
For example, in the following version history: | ||
|
||
``` | ||
_c_ | ||
/ \ | ||
/__b__d__ __f__ __h | ||
/ \ / \ / | ||
a e g | ||
``` | ||
|
||
`g` is the latest version. Both `a` and `e` were previously the latest version. | ||
No other revisions were ever the latest version. In this example, the following | ||
links could be provided: | ||
|
||
| revision | `latest-version` | `working-copy` | `predecessor-version` | `successor-version` | `prior-working-copy` | `subsequent-working-copy` | | ||
| `a` | `g` | `h` | no link | `e` | no link | `b` | | ||
| `b` | `g` | `h` | `a` | `e` | `a` | `c` | | ||
| `c` | `g` | `h` | `a` | `e` | `b` | `d` | | ||
| `d` | `g` | `h` | `a` | `e` | `c` | `e` | | ||
| `e` | `g` | `h` | `a` | `g` | `d` | `f` | | ||
| `f` | `g` | `h` | `e` | `g` | `e` | `g` | | ||
| `g` | no link | `h` | `e` | no link | `f` | `h` | | ||
| `h` | `g` | no link | `e` | no link | `g` | no link | | ||
|
||
> Note: In this example, `f` has both a `predecessor-version` and | ||
> `prior-working-copy` link to `e` because `e` was a version but it also was the | ||
> revision to which changes could be applied before `f` was created. | ||
|
||
# Version History | ||
|
||
A server **MAY** provide a "version history" endpoint. The primary data | ||
gabesullice marked this conversation as resolved.
Show resolved
Hide resolved
|
||
of a response document from a version history endpoing must be a collection of | ||
resource objects. | ||
|
||
Unless an `id` contains version information, the `type` and `id` members of each | ||
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. [Spec compliance] Having multiple resource objects in
So, if this version history response isn't a compound document, you're technically in the clear. But the intent has always been that this restriction should apply to all responses. (I can't find the link for that now, but it's come up in conversations with @dgeb over the years.) Note: I've also proposed removing the restriction altogether. 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. It is not intended to be a compound document. I don't think this profile can impose a requirement that I've been considering adding a recommendation that implementations add information to resource object's
The rule would be something like:
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. I just read the #824 PR. I like the idea of a 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. 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. I also like a Taking this further, there are multiple potential axes along which a variant of a resource can exist: I'd say versioning and translations are the two most common needs. I think we should keep both in mind if we're going to go this direction. But for the sake for consistency and optionality (to ensure backwards compatibility & evolvability), I think we should consider not adding a After having written this, I continued reading #824, to make sure I didn't miss anything. I think my 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. Crazy thought... maybe we could we extract a variant profile out of this profile? Re-minting In fact, if this variation scheme were part of the base spec, then revisions, translations, etc could just enhance that mechanism for its needs. 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. @wimleers noted very important thing. It's not enough to add version of the resource because each resource could have many translations and each translation could have it's own versions. 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. Word |
||
resource object in the collection **MUST** be the same. | ||
|
||
If provided, resource objects' `self` links **MUST NOT** be the same. | ||
|
||
# Version Negotiators | ||
gabesullice marked this conversation as resolved.
Show resolved
Hide resolved
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. [Design feedback/interoperable implementations review requirement] If I'm understanding correctly, each server implementation can define its own version negotiators, with multiple servers using the same negotiator name in different ways (and no central registry). That seems not great for interoperability. It would also seem to mean that no other version negotiators can ever be standardized as part of this profile, because they could conflict with existing implementations. Is that really what you want? My gut instinct would be to make this profile's spec the canonical list of all legal version negotiators. Then, you can add more over time to this spec as they're requested. To support people who really need to use a version negotiator that isn't part of your profile, you could have some set of negotiator names/schemes/namespaces that are allowed to have implementation-specific meanings. 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. 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. cc: @wimleers cause it's his inbox that I suggested too 😛 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. I'm OK with that. However I still think that doc curies offer a lower barrier of entry. One could document the new crazy negotiator in their blog and have the server implementation point to that, instead of adding it here. Many will just not go through the trouble to send their idea to some email addresses and be potentially blocked by them. 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. I guess I wanted to discourage non-standard negotiators being used as a standard and keep them isolated. My feeling was that sending an email saying "hey, I'd like to add a negotiator like this..." doesn't seem like a super high barrier. In some ways, it's even less difficult than opening a PR. What if we add this:
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. @e0ipso, would that work? |
||
|
||
## ID-Based Version Negotiator | ||
gabesullice marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
Uh oh!
There was an error while loading. Please reload this page.