-
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 |
---|---|---|
|
@@ -73,13 +73,13 @@ schemes. | |
|
||
## Usage | ||
|
||
An endpoint **MAY** support a `resource_version` query parameter to allow a | ||
An endpoint **MAY** support a `resourceVersion` query parameter to allow a | ||
client to indicate which version(s) of a resource should be returned. | ||
|
||
If an endpoint does not support the `resource_version` parameter, it **MUST** | ||
If an endpoint does not support the `resourceVersion` parameter, it **MUST** | ||
gabesullice marked this conversation as resolved.
Show resolved
Hide resolved
|
||
respond with `400 Bad Request` to any requests that include it. | ||
|
||
If an endpoint supports the `resource_version` parameter and a client supplies | ||
If an endpoint supports the `resourceVersion` parameter and a client supplies | ||
it: | ||
|
||
- The server’s response **MUST** contain the most appropriate version of the | ||
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 think "the most appropriate" is unnecessarily vague. Can't we change |
||
|
@@ -95,7 +95,7 @@ it: | |
|
||
## Format | ||
|
||
The value of the `resource_version` parameter **MUST** be a colon-separated | ||
The value of the `resourceVersion` parameter **MUST** be a colon-separated | ||
(U+003A COLON, “:”) string. The first segment of the string **SHOULD** be | ||
interpreted as an identifier for a _version negotiation mechanism_. A version | ||
negotiation mechanism defines how a server will locate an appropriate resource | ||
|
@@ -113,7 +113,7 @@ parameter value is known as the _version identifier_. | |
version-identifier | ||
_______|_________ | ||
/ \ | ||
?resource_version=rel:latest-version | ||
?resourceVersion=rel:latest-version | ||
\_/ \____________/ | ||
| | | ||
version-negotiator | | ||
|
@@ -138,13 +138,13 @@ 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 | ||
When a server processes a request with a `resourceVersion` 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 | ||
**MUST** include the `resourceVersion` query parameter with the same version | ||
identifier that was requested. | ||
|
||
When a server processes a request with a `resource_version` query parameter | ||
all resource object `self` links **SHOULD** contain a `resource_version` query | ||
When a server processes a request with a `resourceVersion` query parameter | ||
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] My biggest piece of feedback about this profile is that it should probably also consider how to update resources (e.g., how to create a new working copy based of an existing one, or change the default version, or reject a PATCH if the resource's working copy has changed from the working copy that the client is trying to apply its PATCH to, etc). When resource versions have come up in the past, these updating use cases were actually the primary motivation, so not addressing them here would seem like a major missed opportunity that might be hard to remedy once this is published. I've put this comment on this paragraph, though, because I think the considerations about updating bear directly on what the Also, if each revision is it's own HTTP resource (i.e., has its own URL), then the JSON:API So this is all stuff to think about... I don't have any conclusions at the moment, but I'll mull it over, and hopefully you guys can too. I think, as usual, it goes back to the weird relationship that JSON:API resource objects have with HTTP's concepts of resources + entities. 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 think it makes sense to treat revisions as immutable. I agree with all that was said in the comment above, but I want to highlight another implicit way of creating revisions that we may need to be explicit about. Many frameworks handle revision creation as part of the store update. In Drupal when you save an entity that supports revisioning by I guess that what I'm saying is that strict regulation of how revisions are created may become hard. However, we can put language on how to create revisions through JSON:API. Where I'm going is, do we want this profile to include revision creation or it can be a separate profile? 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 think I agree.
As above, I think I would like this profile to define how update/delete should be handled.
I think I may be in a minority about this, but I try to deeply appreciate the difference between a top-level Where I'm going with that is pretty simple: the top-level
That means that a
The server response would then be:
The
I think it makes sense too, but I don't think this profile needs to define that. I think it can work either way. Drupal actually does permit updating a revision in-place (whether that's a good idea or not is beside the point 😛 ). With the scheme above, it would be possible for a server to support both in-place editing of a revision or new revision creation via If a server cannot automatically create new revisions via 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. The language about updating resources in the spec seems to jive with what I suggested:
We could go a step further in that language by adding:
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 agree with @ethanresnick that the fact that this profile's narrowness (only defining "read" behavior) is its biggest weakness. (Similarly, I think #824's biggest weakness also was its narrowness, it just was different: it focused on optimistic concurrency control.) On the other hand, I think solid read-only support and leaving modifications to a separate profile or a future iteration is preferable over having a spec that supports fewer use cases (which I think was true of #824 — it did not allow a particular revision to be retrieved). Especially if it's based on another established standard (RFC5829) and therefore likely to be more implementation-agnostic. 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 fascinated by @gabesullice's proposal (and the sample response bodies really help, thanks! 🙏). I'm very curious to find out what @ethanresnick thinks about that :) 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 neglected to give a solid answer for this. As I said above, I think the However, this spec could add something like an 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.
Support a conflict detection mechanism as described in initial review post wasn't discussed enough in my opinion. Something similar to AWS Amplify should be easy to achieve if already having well defined revisions. It was already discussed as part of #824 some time ago. Maybe something like this would be everything needed:
|
||
all resource object `self` links **SHOULD** contain a `resourceVersion` query | ||
parameter which identifies the specific revision represented by that resource | ||
object. | ||
gabesullice marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
@@ -157,11 +157,11 @@ same: | |
"type": "article", | ||
"id": 1, | ||
"links": { | ||
"self": "/article/1?resource_version=id:42" | ||
"self": "/article/1?resourceVersion=id:42" | ||
} | ||
}, | ||
"links": { | ||
"self": "/article/1?resource_version=rel:latest-version" | ||
"self": "/article/1?resourceVersion=rel:latest-version" | ||
} | ||
} | ||
``` | ||
|
Uh oh!
There was an error while loading. Please reload this page.