Collections with typed members

Greetings hydraphils,

I have been studying Hydra on my own for the last few month. Finally, I hit
an issue that my search-fu cannot resolve.

Hydra supports Collections, but as far as I can tell, their members are not
described. For example (using Markus’ demo api) the /users request is
documented as “returns a Collection”. A client would not have apriori
knowledge about the types of elements in the collection. The type can only
be determined by consuming the collection and examining each element. 

The dual problem is when one wants to specify that a POST operation expects
as input a collection of vocab:User. Hydra can express that the expected
input is a Collection, but I cannot find a way to specify the expected type
of the members.

One solution might be to derive a sub class of hydra:Collection (say,
"TypedCollection") and explicitly specify the expected member type (say,
defining an "expectedMemberType" property). This would be informative (to a
human user of the API) but as far as I understand the theory behind, it
would not be normative. A standard JSON-LD parser would see
"expectedMemberType" as a property of "TypedCollection", and would not be
able to deduce the intended constraint on the types of the members.

Any hints how to do this?

Thanks,

Deian

--
Deian Tabakov
Software Engineer

Schlumberger (SIS)
Houston Technology Center
1-713-513-3768 
http://www.software.slb.com/products/foundation/Pages/pipesim.aspx

Received on Friday, 22 January 2016 08:33:24 UTC