Re: [Specifications] Specifying a list of resources of different types in `hydra:operation` `expects` field (#249)

> would imply a resource that is both Folder and File is expected which I believe is far from your requirements.

The goal here was to interact with multiple resources in one request. This was not to be interpreted the same as JSON-LD`@type`:

```json 
{
    "@type": [
        "http://api.example.com/classes/Folder",
        "http://api.example.com/classes/File",
    ]
}
```

The question was the result of certain incomprehensions of the REST architecture style from my part, and basically, it seems that Hydra enforces it in a way by using the `expects` to link to one resource, which, in retrospect, is a good safeguard for mistakes from people new to REST. 

> First of all - I'd split it into several operations each expecting different class. Your example:

I closed the question because I am in the process of developing another way to do this using the `expects`. The best design to achieve my purpose is still pending, but one of the solutions involves changing the state of a resource e.g. a `Folder` from `draft` to `complete`. This would imply a `PATCH` sent to only modify one field of a resource. Maybe I miss something but I cannot see any way to describe this operation. The `expects` seems to allow to describe a full `Resource`, same as your answer:

> some:Operation hydra:expects some:Resource

Let's say my resource is the following: 

```json
{
    "@context": {
    ...
    },
    "@id": "folders/tgbF5312Kwnb9fdsteDhG6",
    "@type": "classes:Folder",
    "createdAt": "2008-10-31T15:07:38.6875000-05:00",
    "state": "draft",
 "operation": [
   {
            "title": "Change the folder state to `complete`",
            "method": "PATCH",
            "expects": ????
     ...
   }
        ]
    }
}
```

how would we describe the PATCH to only change the state of the `Folder`? 

As for using SHACL, I indeed intend to use it, Integrations exist with client libraries that allows to use SHACL to generate forms from it. I still need to use them and make sure they do what I need but at least I have something to start with if I need something not provided already. Thanks for pointing out these possible solutions. 


-- 
GitHub Notification of comment by visva-io
Please view or discuss this issue at https://github.com/HydraCG/Specifications/issues/249#issuecomment-1729404840 using your GitHub account


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

Received on Thursday, 21 September 2023 11:45:26 UTC