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:
Benjamin Fleischer 2017-10-13 23:16:58 -05:00
parent 4bb5272b77
commit 68720cef4d

View File

@ -30,9 +30,13 @@ compare_files() {
}
echo
echo "data"
echo "-------------------------------------data"
compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".data"
echo "included"
# 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\")"
compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".included | .[] | select(.type != \"comments\", .type != \"posts\")"
echo "-------------------------------------included posts"
compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".included | .[] | select(.type == \"posts\")"
echo "-------------------------------------included comments"
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