mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Confirmed difference from jsonapi vs AMS not significant
pretty clear now that the ONLY difference
rendering a `user` with `include: 'posts.comments'`
is that the included post's user relationship
in jsonapirb is `meta: { included: false }`
and AMS is `data: { id: 1, type: users}`
which I guess is to avoid the user's
post's comment from looking up the user?
similarly, the included comment's post relationship
for jsonapi-rb is `meta: { included: false}`
and AMS is `data: { id: 2, type: posts }`
took a bit of jq and diff to figure this out
This commit is contained in:
parent
4bb5272b77
commit
68720cef4d
@ -30,9 +30,13 @@ compare_files() {
|
|||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo "data"
|
echo "-------------------------------------data"
|
||||||
compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".data"
|
compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".data"
|
||||||
echo "included"
|
echo "-------------------------------------included posts"
|
||||||
# compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".included | .[] | select(.type == \"posts\")"
|
compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".included | .[] | select(.type == \"posts\")"
|
||||||
# compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".included | .[] | select(.type == \"comments\")"
|
echo "-------------------------------------included comments"
|
||||||
compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".included | .[] | select(.type != \"comments\", .type != \"posts\")"
|
compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".included | .[] | select(.type == \"comments\")"
|
||||||
|
echo "-------------------------------------included types: ams"
|
||||||
|
jq '.included | .[] | .type' -S < support/json_document-ams.json | sort -u
|
||||||
|
echo "-------------------------------------included types: jsonapi_rb"
|
||||||
|
jq '.included | .[] | .type' -S < support/json_document-jsonapi_rb.json | sort -u
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user