Neo4j-graphql-js: 2.1.0 breaks interfaces with non-null fields

Created on 29 Dec 2018  路  7Comments  路  Source: neo4j-graphql/neo4j-graphql-js

After updating to v2.1.0 I get the following error when I start my server:

Interface field SongCollection.name expects type String! but UserPlaylist.name is type String.

Here's my schema. As you can see, the name property is non-null in both the SongCollection interface and the UserPlaylist type.

interface SongCollection {
  id: ID!
  name: String!
  songs: [Song!]! @relation(name: "HAS_SONG", direction: "OUT")
}

type UserPlaylist implements SongCollection {
  id: ID!
  name: String!
  songs: [Song!]! @relation(name: "HAS_SONG", direction: "OUT") # Define sort order
  owner: User! @relation(name: "CREATED_BY", direction: "OUT") # Define sort order
}

I assume it's related to this change.

All 7 comments

@michaeldgraham any ideas on this?

After further investigation, it looks like in 2.1.0 the augment function is converting all required scalars to optional in each of my types, not just types that implement an interface.

I'll look into this as soon as possible, definitely shouldn't be happening

So I have a fix put together, I'll get a PR submitted sometime this evening / tomorrow morning. Thank you very much for bringing this forward!

Awesome, thank you!

@michaeldgraham any update on this?

I had too many family obligations arise today, with the holiday season and such. I have a long drive ahead of me, but I'll hopefully be sitting down to get the fix in later this evening :)

Was this page helpful?
0 / 5 - 0 ratings