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

I decided to go with json schema in my expectations using the [JSON Schema in RDF](https://www.w3.org/2019/wot/json-schema) which describes JSON schema in RDF and allows to use a tool like [JSON Forms](https://jsonforms.io/), which is supported by the majors front javascript libraries, to generate forms on the client automatically. 

Since `expects` covers anything that be described using `rdfs`: 

```json
    {
      "@id": "hydra:expects",
      "@type": "hydra:Link",
      "label": "expects",
      "comment": "The information expected by the Web API.",
      "domainIncludes": ["hydra:Operation", "hydra:RetractedOperationSpecification"],
      "rangeIncludes": ["rdfs:Resource", "hydra:Resource", "rdfs:Class", "hydra:Class"],
      "isDefinedBy": "http://www.w3.org/ns/hydra/core",
      "vs:term_status": "testing"
    }
``` 

we can use Json schema RDF description to define the value of `expects`.  

```json
{
    "@context": {
        "jsonschema": "https://www.w3.org/2019/wot/json-schema"
    ...
    },
    "@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",
          "name": "folder:change-state",
  "expects": {
      "jsonschema:type": "object",
          "jsonschema:properties": {
              "jsonschema:oneOfEnum": {
           "jsonschema:type": "string",
           "jsonschema:oneOf": [
               {
            "jsonschema:const": "complete"
       },
       {
            "jsonschema:const": "other-state"
                    }
                         ]
                    }      
     }
      ]
}
```

The requirements here would be to inform the client that I use a jsonschema extension.   

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


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

Received on Monday, 25 September 2023 01:54:40 UTC