[Specifications] Retracting operations (#241)

alien-mcl has just created a new issue for https://github.com/HydraCG/Specifications:

== Retracting operations ==
It seems that hydra is missing one final feature in it's core - retracting (or forbidding) operations.

While allowing operations is cool, there are situations when _cancelling_ those allowances would come in handy.

Imagine a situation, when there is an operation allowed on a specific class of resources, but due to some specific circumstances, a very specific resource of that given class may be in a state that would forbid an operation from executing. API should have a way of telling it.

Proposed solution - adding a new resource level predicate `forbiddenOperation` which could take precedence over already existing `operation` (also on resource level) and `supportedOperation` on API documentation level.
The only issue I see here is how to _identify_ an operation being forbidden.

The easiest would be just to assign an operation previously declared an IRI which could then be pointed by the `forbiddenOperation`.

Example

```http
GET /api?documentation

{
  "supportedClass": "api:User",
  "api:User": {
    "supportedOperation": {
      "@id": "api:deleteUser",
      "method": "DELETE"
    }
  }
}
```

```http
GET /api/user/1

{
  "forbiddenOperation": "api:deleteUser"
}
```

The example above declares an operation _deleteUser_ for all resources of class _User_, but a very resource of _/api/user/1_ disallows that operation due to i.e. fact this user is still on the registration stage and business rules does not allow to delete it prematurely.

Feel free to deliberate on that feature as I'd love to add required specification changes to have it in the core.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 11 July 2021 19:09:45 UTC