Hi. I have been successfully defining schemas that use relationships with interfaces but I just tried to do this with a relationship type that has properties and then the schema won't validate.
Example:
Using the schema from the docs with: Person, User, and Actor, etc I want to include the friends relationship as part of the Person Interface but attach a since property to the friends relationship. My approach was this:
interface Person {
id: ID!
name: String
friends: [Friend]
}
type Friend @relation (name: "FRIEND_OF") {
from: Person
to: Person
since: Date
}
type User implements Person {
id: ID!
name: String
friends: [Friend]
screenName: String
reviews: [Review] @relation(name: "WROTE", direction: OUT)
}
type Actor implements Person {
id: ID!
name: String
friends: [Friend]
movies: [Movie] @relation(name: "ACTED_IN", direction: OUT)
}
type Movie {
movieId: ID!
title: String
}
type Review {
rating: Int
created: DateTime
movie: Movie @relation(name: "REVIEWS", direction: OUT)
}
When I run this the schema validator complains that the type User is implementing the Friend relationship but that Friend is defined as having the to and from types as Person. I assumed the validator would resolve the use of types implementing interfaces for these fields. Is there another way to handle this or am I missing something?
Thanks,
Nick