Re: [Specifications] Actions with explicit target

Reviewed 8 of 8 files at r3.
Review status: all files reviewed at latest revision, 6 unresolved discussions.

---

*[drafts/use-cases/1.1.security-considerations.md, line 35 at r3](https://reviewable.io:443/reviews/hydracg/specifications/154#-L5Fjs7pVaFH-CFN_F4A:-L7TJA7y1cGxF2Ba68VS:bmsnabs) ([raw file](https://github.com/hydracg/specifications/blob/fa23516a0e71bf50633726d839217103245d7544/drafts/use-cases/1.1.security-considerations.md#L35)):*
<details><summary><i>Previously, alien-mcl (Karol Szczepański) wrote…</i></summary><blockquote>

I though it is the `action` that would have a target defined - `operation` would still be dependent on it's owner in that manner. This way we would leave operations compatible with current spec. Otherwise I don't see any benefit in introducing actions at all - we could incorporate all those details in operations as we do no i.e. in Heracles.ts (with adding `target` as this is the only part that's missing)
</blockquote></details>

Adding it to the action wouldn't work as there might be multiple operations allowing you to perform the action. The use case at hand would be using different protocols like either sending an HTTP request or a GRPC request.

---

*[drafts/use-cases/1.entry-point.md, line 94 at r3](https://reviewable.io:443/reviews/hydracg/specifications/154#-L6qKMefMi47gmHpdvUv:-L7TMI1PEu-RSm8oALHW:b-rgqehm) ([raw file](https://github.com/hydracg/specifications/blob/fa23516a0e71bf50633726d839217103245d7544/drafts/use-cases/1.entry-point.md#L94)):*
<details><summary><i>Previously, tpluscode (Tomasz Pluskiewicz) wrote…</i></summary><blockquote>

Isn't it weird to have this id repeated here where it's the subject of `action`?
</blockquote></details>

For embedded actions/operations it is, yeah. But it may be fine as they would only be used rarely. @elf-pavlik could you please add an example illustrating how this would work in a `ApiDocumentation`? We would likely support two cases there: a) explicit target and b) implicit target that depends, e.g., on a resource's class

---

*[drafts/use-cases/5.1.creating-event-with-put.md, line 67 at r1](https://reviewable.io:443/reviews/hydracg/specifications/154#-L2FGn5gasTIWY81_mpI:-L7TKdcGw7rMRG_-epS3:b-aiwdg2) ([raw file](https://github.com/hydracg/specifications/blob/aa28c5c639dde02c9aacfaf7f5d7121b0d7caa3b/drafts/use-cases/5.1.creating-event-with-put.md#L67)):*
<details><summary><i>Previously, tpluscode (Tomasz Pluskiewicz) wrote…</i></summary><blockquote>

Meaning we actually want to remove `memberTemplate` completely?
</blockquote></details>

Yes. Pavlik already replaced it's need for PUTs here. We could do the same for GETs by adding the following action

```
    {
        "@type": "schema:DiscoverAction",
        "title": "Directly access a member of the collection (if it exists)",
        "operation": {
            "@type": "Operation",
            "method": "GET",
            "target": {
                "@type": "IriTemplate",
                "template": "http://example.com/api/event{/slug*}",
                "variableRepresentation": "BasicRepresentation",
                "mapping": [
                    {
                        "@type": "IriTemplateMapping",
                        "variable": "slug",
                        "property": "schema:name",
                        "required": true
                    }
                ]
            }
        }
    }
```

---

*[drafts/use-cases/5.1.creating-event-with-put.md, line 28 at r3](https://reviewable.io:443/reviews/hydracg/specifications/154#-L6qL2xZ0izObS8VgEvs:-L7TJt-6sdG8I4EOGXVa:b-gw9zxy) ([raw file](https://github.com/hydracg/specifications/blob/fa23516a0e71bf50633726d839217103245d7544/drafts/use-cases/5.1.creating-event-with-put.md#L28)):*
<details><summary><i>Previously, tpluscode (Tomasz Pluskiewicz) wrote…</i></summary><blockquote>

So this should be called `getActionsOfType` and the operation takes from `action.operation`?
</blockquote></details>

Or simply something like `getOperations()` or `getOperationsForAction()` given that we want to find operations and not actions.

---

*[drafts/use-cases/5.1.creating-event-with-put.md, line 33 at r3](https://reviewable.io:443/reviews/hydracg/specifications/154#-L6qLS1rPACGmw8J2dm2:-L7TLWqhOzvZJa0Up6oe:b-yeat0n) ([raw file](https://github.com/hydracg/specifications/blob/fa23516a0e71bf50633726d839217103245d7544/drafts/use-cases/5.1.creating-event-with-put.md#L33)):*
<details><summary><i>Previously, tpluscode (Tomasz Pluskiewicz) wrote…</i></summary><blockquote>

So the expansion uses the variable name or the property?
Any why did is change from array to a string?
</blockquote></details>

I agree with Pavlik that the application using Heracles should provide the property and not know anything about the variable name as it is an implementation detail that may change at any time.

---


*Comments from [Reviewable](https://reviewable.io:443/reviews/hydracg/specifications/154)*
<!-- Sent from Reviewable.io -->


-- 
GitHub Notification of comment by lanthaler
Please view or discuss this issue at https://github.com/HydraCG/Specifications/pull/154#issuecomment-372578473 using your GitHub account

Received on Tuesday, 13 March 2018 08:01:33 UTC