[Specifications] Extend PartialCollectionView with currently set filter

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

== Extend PartialCollectionView with currently set filter ==
We have a way for defining collection filtering using template but when the partial representation comes back from the server it doesn't include the variables used on said template. To illustrate, here's a collection snippet from the wiki:

``` json
{
  "@id": "/markus/friends",
  "@type": "Collection",
  "totalItems": 578
  "member": [  ],
  "view": [
    {
      "@id": "/markus/friends?first=Ruben",
      "@type": "PartialCollectionView",
      "totalItems": 15
    },
    {
      "@type": "ViewTemplate",
      "template": "/markus/friends{?first,last}",
      "mapping": [
        { "variable": "first", "property": "schema:givenName" },
        { "variable": "last", "property": "schema:familyName" }
      ]
    }
  ]
}
```

Currently we have no explicit way to determine that the template was constructed with values `{ "first": "Ruben" }`. Of course it is technically possible to reverse the IRI template expansion, some libraries do support that, but what if there are more than one `ViewTemplate`? 

Why do I think it's important? Because without this importation the client has a a hard time to fill a filtering form in the UI.

What I'd see here an optionally array of variables under the `PartialCollectionView`. Something like

```
{
  "@id": "/markus/friends?first=Ruben",
  "@type": "PartialCollectionView",
  "totalItems": 15,
  "templateVariables": [
    { "variable": "first", "value": "Ruben" }
  ] 
}
```

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

Received on Saturday, 4 November 2017 21:01:40 UTC