feat: add one to one relationship for embedding
BREAKING CHANGE: For the cases where one to one relationships are detected, json objects will be returned instead of json arrays of length 1. If you wish to override this behavior, you can use computed relationships to return arrays again.
This commit is contained in:
committed by
Steve Chavez
parent
2afe13fa89
commit
c45e85c5a6
@@ -92,10 +92,18 @@ spec = describe "computed relationships" $ do
|
||||
{"name":"fezz","child_web_content":[{"name":"wut"}],"parent_web_content":{"name":"tardis"}}
|
||||
]|] { matchHeaders = [matchContentTypeJson] }
|
||||
|
||||
it "can override detected relationships" $ do
|
||||
it "can override many-to-one and one-to-many relationships" $ do
|
||||
get "/videogames?select=*,designers!inner(*)"
|
||||
`shouldRespondWith`
|
||||
[json|[]|] { matchHeaders = [matchContentTypeJson] }
|
||||
get "/designers?select=*,videogames!inner(*)"
|
||||
`shouldRespondWith`
|
||||
[json|[]|] { matchHeaders = [matchContentTypeJson] }
|
||||
|
||||
it "can override one-to-one relationships(would give disambiguation errors otherwise)" $ do
|
||||
get "/first_1?select=*,second_1(*)"
|
||||
`shouldRespondWith`
|
||||
[json|[]|] { matchHeaders = [matchContentTypeJson] }
|
||||
get "/second_1?select=*,first_1(*)"
|
||||
`shouldRespondWith`
|
||||
[json|[]|] { matchHeaders = [matchContentTypeJson] }
|
||||
|
||||
Reference in New Issue
Block a user