Allow returns/expects to be expressed in terms of a media type#186
Conversation
…xpects predicate values.
tpluscode
left a comment
There was a problem hiding this comment.
I think we're opening a can of worms with changes to the returns property.
The returned representation would be dependent upon the requested accept header. And so the client cannot really rely on the returns annotation. Nor should it in fact. One previously example is application/problem+json. A server can any time, in case of an error, return such response, completely disregarding what the API Documentation says.
With Postel's law in mind, I think it only makes sense to add such annotation to the expects end to let the client know that a given resource is intended for non-RDF payloads. On the receiving end any such information should be added sparingly.
So, how would it look like to expect "image/png" for example? And wouldn't it be sufficient to use |
But with current hydra specification it also means that server may return something completely different than declared
It does. See that example: With range of |
I don't think so. My server can process |
Agreed. We could do that if it was possible to specify it further, as ImageObject with a specific schema:encodingFormat similar to what I said in #183 (comment) |
Ah, I've cached that thought with my comment. Indeed that approach with constraint-like is interesting. I think it could sit side-by-side with old |
|
This sounds great indeed. But I think we're way out of scope of Hydra Core... |
Why is that? I believe having a generic mechanism that would allow to describe precisely what kind of resources are expected/returned is mandatory in the core. Core won't contain any mentioned image definitions, but a raw tools so other can make those definitions |
|
I do agree. Without more concrete example it's hard to judge the intentions. I meant this remarks as precaution that schema.org for example has no place in the Core. It could, however, be a part of an auxiliary vocabulary, to be used together with Hydra, to define image-specific constraints. The problem as I understand it, is that we'd want to describe constraints for non-RDF payloads using RDF structures. In the example you were discussing, describe specifics of an image file using |
We'd want to describe both that way. Currently by saying It would also enable the vocabulary for non-RDF specifications and RDF specifications that could went far beyond simple class matching (in API documentations you could specify returned collection) |
…tion. Also merged with latest master line
|
I've changed the approach with this issue this time. This time I've dropped the resource specification and I didn't got towards request specification neither. All I did was a slight modification of |
|
I think I have one reservation about the current proposal, regarding Naming aside, I think it's not universally sufficient as I see two distinct cases one might want to express:
In the latter case, I think we'd need some way to assert that fact. And for the name I propose more terse |
…to issue/22_Allow_returns_expects_to_be_expressed_in_terms_of_media_type
|
Ok - I've added an additional predicate to indicate a closed set. I decided not to introduce i.e. |
This is a derivative of a PR #182 that covers #22 :