-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix(GraphQL): fix object Linking with
hasInverse
(#6557)
This PR fixes incorrect linking of objects with `hasInverse`. For example For this schema, `type Country` has field `state` with `hasInverse` predicate. ``` type Country { id: ID! name: String! @search(by: [trigram, hash]) states: [State] @hasInverse(field: country) } type State { id: ID! xcode: String! @id @search(by: [regexp]) name: String! capital: String country: Country } ``` And for the following mutation ``` mutation addCountry($input: [AddCountryInput!]!) { addCountry(input: $input) { country { name states{ xcode name country{ name } } } } } ``` with `input`: ``` { "input": { "name": "A Country", "states": [ { "xcode": "abc", "name": "Alphabet" }, { "xcode": "def", "name": "Vowel", "country": { "name": "B country" } } ] } } ``` should result in ``` { "addCountry": { "country": [ { "name": "A country", "states": [ { "country": { "name": "A country" }, "name": "Alphabet", "xcode": "abc" }, { "country": { "name": "A country" }, "name": "Vowel", "xcode": "def" } ] } ] } }` ``` whereas the incorrect output was ``` { "addCountry": { "country": [ { "name": "A country", "states": [ { "country": { "name": "A country" }, "name": "Alphabet", "xcode": "abc" }, { "country": { "name": "B country" }, "name": "Vowel", "xcode": "def" } ] } ] } }` ``` This PR fixes this issue.
- Loading branch information
1 parent
b543f75
commit e496467
Showing
4 changed files
with
171 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters