Closed fancyremarker closed 10 years ago
Hi @fancyremarker! You have been busy lately! Thanks so much for your contributions.
I agree completely with the intent of this PR; supporting a type
attribute is something I've been thinking about for a while. I am leaning toward implementing it differently, by turning HR.get_data_type_from_response
into a more general HR.get_data_type
method, which accepts a Faraday::Response
, a HyperResource
, or just a Hash
. But I will definitely get this in for 0.9 (within the month), and I will leave this pull request open until I do.
Thanks again for submitting good features! Keep 'em coming! :)
Thanks for the feedback, @gamache. I agree with the implementation you've suggested. What I've submitted here was more of a shortest-path hack.
Please let me know if I can help with any of the implementation.
Hey @gamache! I'm interested in implementing automatic typing for embedded resources (in particular individual objects within a collection, much as you've done for response-level resources.
The existing approach of examining response headers (i.e., the
type
parameter of theContent-Type
header) won't necessarily map well to the problem of typing embedded resources. Here I've somewhat arbitrarily chosen to examine thetype
field of each resource. It works for me, but I'd like to hear what you think is the most appropriate default for determining types of embedded resources.Thanks!