You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The json-api spec says that meta can be present on a resource object, so I took advantage of that to return some additional data there in my api.
It took me awhile to figure out why my meta hash for a single record response wasn't available anywhere. The JSONAPISerializer hooks all showed that the meta key was present. It wasn't until I stepped into the code and got into store.push and store._push that I realized this was were the meta hash was getting ignored.
store._push takes one argument jsonApiDoc and the only member that's ever accessed off of it is data. Looks like this code passes jsonApiDoc.data off to store._pushInternalModel so I don't think the fix would be trivial.
I sort of got around this by creating a meta attr on my model and then moving the meta hash to data.attributes.meta during the normalizeSingleRecord hook in the model's serializer.
I'm guessing this is all going to be affected by the model-data rfc, so I guess I'm just wondering if anyone else has run into this problem and has a better fix.
The text was updated successfully, but these errors were encountered:
Just fyi, I tried putting meta as both a top-level member { data: {...}, meta: {...}} and as a member of data: { data: {..., meta: {...}}. Both options seem valid according to the json-api spec.
We sadly don't have a good story around metalinks and errors today at the resource, relationship or document level. This is something we will be addressing this year.
The json-api spec says that
meta
can be present on a resource object, so I took advantage of that to return some additional data there in my api.It took me awhile to figure out why my
meta
hash for a single record response wasn't available anywhere. The JSONAPISerializer hooks all showed that themeta
key was present. It wasn't until I stepped into the code and got intostore.push
andstore._push
that I realized this was were themeta
hash was getting ignored.store._push takes one argument
jsonApiDoc
and the only member that's ever accessed off of it isdata
. Looks like this code passesjsonApiDoc.data
off tostore._pushInternalModel
so I don't think the fix would be trivial.I sort of got around this by creating a
meta
attr on my model and then moving themeta
hash todata.attributes.meta
during thenormalizeSingleRecord
hook in the model's serializer.I'm guessing this is all going to be affected by the model-data rfc, so I guess I'm just wondering if anyone else has run into this problem and has a better fix.
The text was updated successfully, but these errors were encountered: