Closed asbjornu closed 7 years ago
If definition of hydra:collection
property includes statement
hydra:collection rdfs:range hydra:Collection
client can expect an instance of a collection.
BTW I think this issue fits https://github.com/HydraCG/Heracles.ts since I suggested getCollection()
method as an interface which could decorate an instance of hydra:EntryPoint
Yes, but the definition is flexible. Even the ApiDocumentation
isn't static. Hard coding getCollection()
would therefore break if the following the link results in something that is not a collection.
No callbacks please, promises :wink:
I really thing that discussion about interfaces specific to client implementation (getCollection()
) belongs to the reference client implementation: https://github.com/HydraCG/Heracles.ts I wouldn't even mind removing client snippets from use cases and only keep information here about the data and HTTP usage. Heracles.ts could include documentation about all the interfaces it includes.
When it comes definition of hydra:collection
, even if for whatever reason we would decide to use schema:rangeIncludes
instead of rdfs:range
in its definition. I think we should clearly state that it shouldn't get used to reference something which @type
doesn't include hydra:Collection
. Otherwise we should not call this property hydra:collection
.
BTW I think this issue fits https://github.com/HydraCG/Heracles.ts since I suggested
getCollection()
method as an interface which could decorate an instance ofhydra:EntryPoint
Of course, I only created this here because the discussion started in a PR in this repository. Sorry!
If I'm not mistaken, that's what @alien-mcl is already discussing in HydraCG/Heracles.ts#2, so I'll just add my thoughts there and will close this issue.
In https://github.com/HydraCG/Specifications/pull/132#issuecomment-323815173 @alien-mcl writes:
I agree that this is an issue. To decouple the request from the response, wouldn't a better design be to handle all responses through a callback instead? Then the request will just follow links in a completely generic way and it's up to the response callback handler to understand the context and how to deal with the different response types.
Thoughts?