neo4j-graphql-js icon indicating copy to clipboard operation
neo4j-graphql-js copied to clipboard

Response type for autogenerated queries should be non-null array on non-null types

Open smkhalsa opened this issue 6 years ago • 1 comments

The autogenerated queries are currently returning nullable lists of nullable types. For example, if I've defined the following type:

type Song {
  id: ID!
  name: String!
  artists: [Artist!]! @relation(name: "BY_ARTIST", direction: "OUT")
  albums: [Album!]! @relation(name: "IN_ALBUM", direction: "OUT")
}

The following query would be generated:

Song(
  id: ID
  name: String
  _id: String
  first: Int
  offset: Int
  orderBy: _SongOrdering
): [Song]

However, the return type should instead be [Song!]! since it will always return a non-null array, and the items in the array will always be of non-null type Song.

smkhalsa avatar Dec 16 '18 16:12 smkhalsa

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

michaeldgraham avatar May 02 '21 04:05 michaeldgraham