cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Relationships in @neo4j/graphql 3.6, using Movies database

ChakaBrah
Node Link

Hi all, 

As I was following this tutorial https://neo4j.com/developer/graphql/, I noticed something in the latest JavaScript graphql driver. Namely, when I change the relation definitions on the Movies ACTED_IN relationship in the typeDef from "actors: [Person!]!" to "actors: [Person]", I get the error message: 

 
Error: List type relationship fields must be non-nullable and have non-nullable entries, please change type of Movie.actors to [Person!]!
 
However, when I try to create a movie (using the required [Person!]! in the typeDef) without a "ACTED_IN" relationship in the GraphQL playground, using the auto-generated createMovies mutation, that seems to work fine. This is also confirmed in Neo4j Browser.
 
This is actually my preferred behavior, but am I correct to see that this is a deviation from the normally strictly strongly typed GraphQL convention (e.g. forcing fields denoted by ! to be required at all times)? Is this because it has the @relationship directive, or does this have a different reason?
 
Love the package, trying to understand it more deeply.
 
Cheers,
Chaka
1 REPLY 1

Aaronoooooo
Node Link

sdfa