Extend describing operations

Hi

I've been thinking about this for some time. Consider a blogging 
platform, where I can POST a blog post

HTTP/1.1 POST /blog

{ "title": "My blog post", "text": "some markdown maybe"  }

But instead of getting published immediately, it could create a draft 
at, say /drafts/my-blog-post.

Now how would I use Hydra to model an operation, which publishes the 
draft? I would think of a POST operation like

HTTP/1.1 POST /blog/published

{ "@id": "/drafts/my-blog-post" }

Unfortunately I don't see how that would be possible. This raises a 
number of questions:

1. Should it be possible to define complete or partial body of an 
operation in addition to the "expects" property? I'm thinking

{
   "operation": [
     "expects": "BlogPost",
     "body": {
       "title": "New blog post"
     }
   ]
}

If the "expects" was absent, the "body" would be the complete request to 
be sent by the client. Otherwise it could serve as an initial 
representation to create the UI/form.

2. Should it be possible to have an operation not on self but on another 
resource. This is what I could write to describe the publish operation 
above:

{
   "operation": [
     "@type": "PublishOperation",
     "url": "/blog/published",
     "body": { "@id": "/drafts/my-blog-post" }
   ]
}

I'm feeling kind of like the "/blog/published" resource should be a link 
with it's own operation. I'm still not sure how what to do about the 
predefined "body".

Best,
Tom

Received on Sunday, 13 March 2016 15:51:14 UTC