[Specifications] Specifying operations on TemplatedLink objects

tpluscode has just created a new issue for https://github.com/HydraCG/Specifications:

== Specifying operations on TemplatedLink objects ==
I wasn't sure how to phrase the title but I hope it's clear enough. I'd asked in the past about a away to specify operations which have a variable target (ie. an `IriTemplate`). It just dawned on me that I may have been looking at this from the wrong side. Please help me verify my assumptions and possible usage.

Given that the templated link is a property, and a `hydra:Resource`, it should be possible to attach an operation to, right? So, assuming `ex:tag` is a `hydra:TemplatedLink`, should it be legal to have:

``` json
{
  "ex:tag": {
    "@type": "IriTemplate",
    "template": "http://example.com/tag/{tag}",
    "mappings": [{ "variable": "tag" }],
    "operation": [
      {
        "method": "POST",
        "expects": { "@type": "ex:NotificationRequest" }
      },
      {
        "method": "DELETE"
      }
    ]
  }
}
```

I don't see anything that contradicts the semantics of current vocab. Does the above come close to resolving #100.

By extension, I believe that if we allowed hydra:returns on IriTemplate (#50) then it would be possible to take advantage os `hydra:SupportedOperation` to define actions possible to perform on templates targets.

``` json
{
  "ex:tag": {
    "@type": "IriTemplate",
    "template": "http://example.com/tag/{tag}",
    "mappings": [{ "variable": "tag" }],
    "returns": "ex:Tag"
}
```

Where `ex:Tag` could support the `DELETE`/`POST` operations inlined in the first snippet.

Please view or discuss this issue at https://github.com/HydraCG/Specifications/issues/118 using your GitHub account

Received on Monday, 24 April 2017 20:08:45 UTC