Closed jprincipe closed 8 years ago
Very useful PR indeed, although I believe the JSON API spec does not allow for a "custom meta key", so the setMetaKey
kind of bothers me. Thoughts?
I agree based on the spec. I only added it because active_model_serializers allows for customizing the key
Actually AMS allows this only for the Json
serializer, not for the JsonApi
one. I think we can remove it for now, and if there's a strong need for it (which I doubt) we'll add it back.
Just looked at the ams source and meta_key
is defined in the base adapter. I see that you have a change in ams master around the meta_key. Is that code in rc3?
I tested this out locally on rc3 and sure enough if I set meta_key in the render, the meta data is returned with the custom key
Yeah, but this is just a byproduct of shared code between adapters. AMS does not officially support custom meta key, and I'll probably get rid of it when I'm done with deserialization and some other stuff.
@beauby I removed the meta_key from the code and defaulted the meta response to null if the meta
key doesn't exist
LGTM – If you could just fix the docs to specify which meta
property it supports, that'd be great! Thanks again :+1:
this PR adds support for processing meta data from the JSON payload. For backwards compatibility I left the
sync()
method the same and added a newsyncWithMeta()
method that returns both the data and meta data at the same time. The key for meta data is defaulted tometa
but it can be overridden using thesetMetaKey
method.