You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Will call <api#post-get> because it is directly supported by the <api#Post> class.
Match by SupportedProperty -> supportedOperation
POST /post/easy-hydra/comments<> schema:title "Now you convinced me to RDF" .
Will call <api#comment-post> because it is supported by the <api#comments>
property and/post/easy-hydra/comments resource is an object of that relation.
Match by payload type
PUT /post/easy-hydra<api/post/easy-hydra> a <Post> .
Even though the requested resource does not exist, I expect it would call
<api#post-put> based on the method and requested representation.
Failed requests
Sending the wrong rdf:type
PUT /post/easy-hydra/comment/1<> a <Post> .
Trying to replace the representation of a comment with a post? Nope.
Although a PUT request would be allowed by the <post/easy-hydra/comment/1>
resource, the payload type does not match.
No operation
DELETE /post/easy-hydra/comments
This one is quite obvious. No such operation on this resource at all. Status 405
Undecided
Ambiguous
DELETE /post/easy-hydra/comment/1
The resource supports this operation both by its class as well as the
<api#my-comments> property. 🤷
Status 500 unless selected by custom code?
Implicit
GET /me
I propose to have an API-wide option to implcitly return the representation of any
resource on a GET resource, even if it does not have a SupportedOperation.
Might be set up as an optional handler?
import * as hydra from 'hydra-box'
// the usual, to load representation and find operations
app.use(hydra.middleware()
// fall back to this one which will simply pass on req.hydra.resource.dataset
app.use(hydra.implicitRepresentation({
// possibly with some options to fine-tune this behavior
}))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters