graphql
graphql copied to clipboard
Relationships with a cardinality of [1-n]
Is your feature request related to a problem? Please describe. It is currently possible to define relationships with the following cardinalities using the relationship directive:
type Movie {
genre: Genre @relationship(type: "HAS_GENRE", direction: OUT) #Cardinality: [0-1]
genre: Genre! @relationship(type: "HAS_GENRE", direction: OUT) #Cardinality: [1-1]
genres: [Genre!]! @relationship(type: "HAS_GENRE", direction: OUT) #Cardinality: [0-n]
#How do we create a cardinality of [1-n]?
}
Describe the solution you'd like We need a way to create relationships with a cardinality of [1-n]. For example, we want to create objects of type Movie and Genre. A movie can have multiple genres and should have at least one genre.
Additional context It might be interesting if you can create any cardinalities such as [2-2] -> A movie should have exactly two genres.