-
Notifications
You must be signed in to change notification settings - Fork 153
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 #5819 from neo4j/remove-single-relationship
Remove single relationships
- Loading branch information
Showing
225 changed files
with
2,606 additions
and
21,501 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
"@neo4j/graphql": major | ||
--- | ||
|
||
Single element relationships have been removed in favor of list relationships: | ||
|
||
Before | ||
|
||
```graphql | ||
type Movie { | ||
director: Person @relationship(type: "DIRECTED", direction: "IN") | ||
} | ||
``` | ||
|
||
After | ||
|
||
```graphql | ||
type Movie { | ||
director: [Person!]! @relationship(type: "DIRECTED", direction: "IN") | ||
} | ||
``` | ||
|
||
This requires updating filters, clients and auth rules to use the list filter operations. | ||
|
||
Single element relationships cannot be reliably enforced, leading to a data inconsistent with the schema. If the GraphQL model requires 1-1 relationships (such as in federations) these can now be achieved with the `@cypher` directive instead: | ||
|
||
```graphql | ||
type Movie { | ||
director: Person | ||
@cypher( | ||
statement: """ | ||
MATCH(this)-[:ACTED_IN]->(p:Person) | ||
RETURN p | ||
""" | ||
columnName: "p" | ||
) | ||
} | ||
``` |
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
Oops, something went wrong.