-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from hasura/djh/NDAT-1028/add-relationships-test
chore: add very recursive relationship test
- Loading branch information
Showing
3 changed files
with
326 additions
and
0 deletions.
There are no files selected for viewing
129 changes: 129 additions & 0 deletions
129
crates/ndc-sqlserver/tests/goldenfiles/very_nested_recursive_relationship.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
{ | ||
"collection": "Artist", | ||
"query": { | ||
"fields": { | ||
"0Name": { | ||
"type": "column", | ||
"column": "Name", | ||
"arguments": {} | ||
}, | ||
"Albums": { | ||
"type": "relationship", | ||
"relationship": "ArtistAlbums", | ||
"arguments": {}, | ||
"query": { | ||
"fields": { | ||
"0Title": { | ||
"type": "column", | ||
"column": "Title", | ||
"arguments": {} | ||
}, | ||
"Artist": { | ||
"type": "relationship", | ||
"relationship": "AlbumArtist", | ||
"arguments": {}, | ||
"query": { | ||
"fields": { | ||
"0ArtistId": { | ||
"type": "column", | ||
"column": "ArtistId", | ||
"arguments": {} | ||
}, | ||
|
||
"Albums": { | ||
"type": "relationship", | ||
"relationship": "ArtistAlbums", | ||
"arguments": {}, | ||
"query": { | ||
"fields": { | ||
"0Title": { | ||
"type": "column", | ||
"column": "Title", | ||
"arguments": {} | ||
}, | ||
"Artist": { | ||
"type": "relationship", | ||
"relationship": "AlbumArtist", | ||
"arguments": {}, | ||
"query": { | ||
"fields": { | ||
"0Name": { | ||
"type": "column", | ||
"column": "Name", | ||
"arguments": {} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"order_by": { | ||
"elements": [ | ||
{ | ||
"order_direction": "asc", | ||
"target": { | ||
"type": "column", | ||
"name": "AlbumId", | ||
"path": [] | ||
} | ||
} | ||
] | ||
}, | ||
"limit": 3 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"order_by": { | ||
"elements": [ | ||
{ | ||
"order_direction": "asc", | ||
"target": { | ||
"type": "column", | ||
"name": "AlbumId", | ||
"path": [] | ||
} | ||
} | ||
] | ||
}, | ||
"limit": 3 | ||
} | ||
} | ||
}, | ||
"order_by": { | ||
"elements": [ | ||
{ | ||
"order_direction": "asc", | ||
"target": { | ||
"type": "column", | ||
"name": "ArtistId", | ||
"path": [] | ||
} | ||
} | ||
] | ||
}, | ||
"limit": 3 | ||
}, | ||
"arguments": {}, | ||
"collection_relationships": { | ||
"ArtistAlbums": { | ||
"column_mapping": { | ||
"ArtistId": "ArtistId" | ||
}, | ||
"relationship_type": "array", | ||
"source_collection_or_type": "Artist", | ||
"target_collection": "Album", | ||
"arguments": {} | ||
}, | ||
"AlbumArtist": { | ||
"column_mapping": { | ||
"ArtistId": "ArtistId" | ||
}, | ||
"relationship_type": "object", | ||
"source_collection_or_type": "Album", | ||
"target_collection": "Artist", | ||
"arguments": {} | ||
} | ||
} | ||
} |
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
191 changes: 191 additions & 0 deletions
191
...erver/tests/snapshots/query_tests__relationships__very_nested_recursive_relationship.snap
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
--- | ||
source: crates/ndc-sqlserver/tests/query_tests.rs | ||
expression: result | ||
--- | ||
[ | ||
{ | ||
"rows": [ | ||
{ | ||
"0Name": "AC/DC", | ||
"Albums": { | ||
"rows": [ | ||
{ | ||
"0Title": "For Those About To Rock We Salute You", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0ArtistId": 1, | ||
"Albums": { | ||
"rows": [ | ||
{ | ||
"0Title": "For Those About To Rock We Salute You", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0Name": "AC/DC" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"0Title": "Let There Be Rock", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0Name": "AC/DC" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"0Title": "Let There Be Rock", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0ArtistId": 1, | ||
"Albums": { | ||
"rows": [ | ||
{ | ||
"0Title": "For Those About To Rock We Salute You", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0Name": "AC/DC" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"0Title": "Let There Be Rock", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0Name": "AC/DC" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"0Name": "Accept", | ||
"Albums": { | ||
"rows": [ | ||
{ | ||
"0Title": "Balls to the Wall", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0ArtistId": 2, | ||
"Albums": { | ||
"rows": [ | ||
{ | ||
"0Title": "Balls to the Wall", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0Name": "Accept" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"0Title": "Restless and Wild", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0Name": "Accept" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"0Title": "Restless and Wild", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0ArtistId": 2, | ||
"Albums": { | ||
"rows": [ | ||
{ | ||
"0Title": "Balls to the Wall", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0Name": "Accept" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"0Title": "Restless and Wild", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0Name": "Accept" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"0Name": "Aerosmith", | ||
"Albums": { | ||
"rows": [ | ||
{ | ||
"0Title": "Big Ones", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0ArtistId": 3, | ||
"Albums": { | ||
"rows": [ | ||
{ | ||
"0Title": "Big Ones", | ||
"Artist": { | ||
"rows": [ | ||
{ | ||
"0Name": "Aerosmith" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
] |