neo4j-graphql / neo4j-graphql-js

NOTE: This project is no longer actively maintained. Please consider using the official Neo4j GraphQL Library (linked in README).
Other
609 stars 148 forks source link

interface relation doesn't supports implemented types #558

Open AdrienLemaire opened 3 years ago

AdrienLemaire commented 3 years ago

I was expecting the following definition to work (creating 2 types of linked lists).

interface ChatEntry {
  id: ID! @id
  from: Character! @relation(name: "WROTE", direction: "IN")
  message: String!
  next: ChatEntry @relation(name: "NEXT", direction: "BOTH")
}

type UserChat implements ChatEntry {
  id: ID! @id
  from: Character! @relation(name: "WROTE", direction: "IN")
  message: String!
  next: UserChat @relation(name: "NEXT", direction: "BOTH")
}

type AdventureLog implements ChatEntry {
  adventure: Adventure @relation(name: "GET_HISTORY", direction: "IN")
  from: Character! @relation(name: "WROTE", direction: "IN")
  id: ID! @id
  message: String!
  next: BoukenLog @relation(name: "NEXT", direction: "BOTH")
}

But I get the error:

Interface field argument ChatEntry.next(filter:) expects type _ChatEntryFilter but UserChat.next(filter:) is type _UserChatFilter. Interface field argument ChatEntry.next(filter:) expects type _ChatEntryFilter but AdventureLog.next(filter:) is type _AdventureLogtFilter.

Kubera2017 commented 3 years ago

Yes, I faced with it too, it is basic inference on interfaces, would be great to have it in the library. But I think it could be related to Apollo capacities, not this library

michaeldgraham commented 3 years ago

https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608