mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Ensure valid jsonapi when blank relationship (#1930)
If you specify include_data false, and do not have any links for this
relationship, we would output something like:
`{ relationships: { comments: {} } }`
This is not valid jsonapi. We will now render
`{ relationships: { comments: { meta: {} } } }`
Instead.
Relevant jsonapi spec: http://jsonapi.org/format/#document-resource-object-relationships
This commit is contained in:
committed by
L. Preston Sego III
parent
a032201a91
commit
a77dfdaa85
@@ -54,7 +54,7 @@ module ActiveModelSerializers
|
||||
end
|
||||
|
||||
def test_relationship_data_not_included
|
||||
test_relationship({}, options: { include_data: false })
|
||||
test_relationship({ meta: {} }, options: { include_data: false })
|
||||
end
|
||||
|
||||
def test_relationship_simple_link
|
||||
|
||||
Reference in New Issue
Block a user