Skip to content

Commit

Permalink
fix: generate relationship definition for nested selection (hasura#855)
Browse files Browse the repository at this point in the history
### What

Previously, while generating relationship definitions for NDC, we would
ignore columns with nested selection.

This PR fixes that.

Closes https://hasurahq.atlassian.net/browse/V3ENGINE-247

### How

While matching on `FieldSelection::Column`, don't ignore it. Check if it
contains nested selection, if it does, call
`collect_relationships_from_nested_selection`

V3_GIT_ORIGIN_REV_ID: 9db94744d8e2d35f8430bded07209ef519175205
  • Loading branch information
ecthiender authored and hasura-bot committed Jul 23, 2024
1 parent a6dbc7b commit 9eaabd1
Show file tree
Hide file tree
Showing 25 changed files with 516 additions and 4 deletions.
8 changes: 6 additions & 2 deletions v3/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

### Fixed

- Fixes a bug where relationships within nested columns would throw an internal
error. While generating NDC relationship definitions, engine would ignore
columns with nested selection.

- Renamed the `ArgumentPreset` for data connectors to
`DataConnectorArgumentPreset` to avoid ambiguity in generated JSONSchema.

Expand Down Expand Up @@ -56,9 +60,9 @@ your GraphQL queries more versatile and powerful.
- Build-time check to ensure boolean expressions cannot be built over nested
array fields until these are supported.

- Fixed a bug where command targeted relationships were not using the Open DD
- Fixed a bug where command targeted relationships were not using the OpenDD
argument name instead of the data connector's argument name when querying the
data connector
data connector.

## [v2024.07.10]

Expand Down
1 change: 1 addition & 0 deletions v3/crates/custom-connector/data/actors.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{"id":0,"name":"Peter","movie_id":2,"favourite_author_id":1}
{"id":1,"name":"Leonardo DiCaprio","movie_id":1,"favourite_author_id":1}
{"id":2,"name":"Kate Winslet","movie_id":1,"favourite_author_id":2}
{"id":3,"name":"Irfan Khan","movie_id":2,"favourite_author_id":1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{
"data": {
"getActorsByMovieIdBounds": [
{
"actor_id": 0,
"movie_id": 2,
"name": "Peter"
},
{
"actor_id": 3,
"movie_id": 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
{
"data": {
"ActorsByMovieMany": [
{
"actor_id": 0,
"movie_id": 2,
"name": "Peter"
},
{
"actor_id": 3,
"movie_id": 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{
"data": {
"getActorsByMovieIdBounds": [
{
"actor_id": 0,
"movie_id": 2,
"name": "Peter"
},
{
"actor_id": 3,
"movie_id": 2,
Expand All @@ -28,6 +33,11 @@
{
"data": {
"getActorsByMovieIdBounds": [
{
"actor_id": 0,
"movie_id": 2,
"name": "Peter"
},
{
"actor_id": 3,
"movie_id": 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{
"data": {
"getAllActors": [
{
"actor_id": 0,
"name": "Peter",
"movie_id": 2
},
{
"actor_id": 1,
"name": "Leonardo DiCaprio",
Expand Down Expand Up @@ -43,6 +48,11 @@
{
"data": {
"getAllActors": [
{
"actor_id": 0,
"name": "Peter",
"movie_id": 2
},
{
"actor_id": 1,
"name": "Leonardo DiCaprio",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{
"data": {
"getAllActors": [
{
"actor_id": 0,
"name": "Peter",
"movie_id": 2
},
{
"actor_id": 1,
"name": "Leonardo DiCaprio",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{
"data": {
"uppercaseAllActorNames": [
{
"actor_id": 0,
"movie_id": 2,
"name": "PETER"
},
{
"actor_id": 1,
"movie_id": 1,
Expand Down Expand Up @@ -43,6 +48,11 @@
{
"data": {
"uppercaseAllActorNames": [
{
"actor_id": 0,
"movie_id": 2,
"name": "PETER"
},
{
"actor_id": 1,
"movie_id": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{
"data": {
"uppercaseAllActorNames": [
{
"actor_id": 0,
"movie_id": 2,
"name": "PETER"
},
{
"actor_id": 1,
"movie_id": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
"data": {
"uppercaseAllActorNamesReturnNames": [
"PETER",
"LEONARDO DICAPRIO",
"KATE WINSLET",
"IRFAN KHAN",
Expand All @@ -15,6 +16,7 @@
{
"data": {
"uppercaseAllActorNamesReturnNames": [
"PETER",
"LEONARDO DICAPRIO",
"KATE WINSLET",
"IRFAN KHAN",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"data": {
"InstitutionMany": [
{
"id": 1,
"location": {
"city": "London",
"campuses": [
"Mile End",
"Whitechapel",
"Charterhouse Square",
"West Smithfield"
]
},
"location_country": {
"country": "UK"
},
"staff": [
{
"last_name": "Landin",
"specialities": ["Computer Science", "Education"],
"actor": {
"name": "Peter"
}
}
],
"staff_first_name": [
{
"first_name": "Peter"
}
],
"departments": [
"Humanities and Social Sciences",
"Science and Engineering",
"Medicine and Dentistry"
]
},
{
"id": 2,
"location": {
"city": "Gothenburg",
"campuses": ["Johanneberg", "Lindholmen"]
},
"location_country": {
"country": "Sweden"
},
"staff": [
{
"last_name": "Hughes",
"specialities": [
"Computer Science",
"Functional Programming",
"Software Testing"
],
"actor": null
},
{
"last_name": "Claessen",
"specialities": [
"Computer Science",
"Functional Programming",
"Automated Reasoning"
],
"actor": null
}
],
"staff_first_name": [
{
"first_name": "John"
},
{
"first_name": "Koen"
}
],
"departments": [
"Architecture and Civil Engineering",
"Computer Science and Engineering",
"Electrical Engineering",
"Physics",
"Industrial and Materials Science"
]
},
{
"id": 3,
"location": null,
"location_country": null,
"staff": null,
"staff_first_name": null,
"departments": ["nothing", null]
}
]
}
}
Loading

0 comments on commit 9eaabd1

Please sign in to comment.