HTTP-APIs/hydra-python-core

Adding IRITemplates for multi-object operations

Closed this issue · 2 comments

I'm submitting a

  • bug report.
  • [ x] feature request.

Current Behaviour:

Right now we use the notations [URL]?instances=id1,id2,id3 for multi-object operations. This format needs to be declared in the API document using an IRI template, since this is the default behaviour in hydrus, we should add such templates automatically per resource whenever we generate the documentation using core.

Expected Behaviour:

IRITemplates for the instances parameter need to be added to the resource declarations in the API documentation.

{
  "@type": "IriTemplate",
  "template": "http://localhost/api/[resource]{?instances}",
  "variableRepresentation": "BasicRepresentation",
  "mapping": [
    {
      "@type": "IriTemplateMapping",
      "variable": "instances",
      "property": "hydra:freetextQuery",
      "required": false
    }
  ]
}

Steps to reproduce:

Do you want to work on this issue?

I'm a little confused how to add another template in HydraIRITemplate class as we already have template for query parameters that can be used for searching. ex:

"hydra:template": "http://localhost:8080/serverapi/MovieCollection{?movie_name, movie_director, pageIndex, limit, offset}",
"hydra:variableRepresentation": "hydra:BasicRepresentation"

@chrizandr @Mec-iS ?

I think this needs to be more general issue about adding custom IRI templates instead. And then we can use that to add IRITemplates for other operations. I'll close this for now and make a more general issue