Migration to 5.0.0

This page lists all breaking changes from the Neo4j GraphQL Library version 4.x to 5.x and how to update it.

How to update

To update your Neo4j GraphQL Library, use npm or the package manager of choice:

npm update @neo4j/graphql

Breaking changes

Here is a list of all the breaking changes from version 4.0.0 to 5.0.0.

@relationshipProperties

The directive @relationshipProperties should now be used on types rather than interfaces. For example:

Before Now
interface ActedIn @relationshipProperties {
    screenTime: Int
}

type Movie {
    title: String
    actors: [Person!]! @relationship(type: "ACTED_IN", direction: IN, properties: "ActedIn")
}

type Person {
    name: String
}
type ActedIn @relationshipProperties {
    screenTime: Int
}

type Movie {
    title: String
    actors: [Person!]! @relationship(type: "ACTED_IN", direction: IN, properties: "ActedIn")
}

type Person {
    name: String
}

Interface directives

To better match the default behavior of GraphQL, library directives used in interfaces will not cascade to the implementing types anymore. This means that most directives are no longer valid in interfaces and have to be defined in the implementing types. This also applies to custom directives.

@declareRelationship

The @relationship directive is no longer available in interfaces. If you need a relationship to be available on interfaces, you need to use the new @declareRelationship directive instead, as well as define the relationships in the concrete type.

This change is due to directives no longer cascading from interfaces to types. However, now it is possible for a relationship to have different properties and labels in each type. For example:

Before

Now

interface Production {
    title: String!
    actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN)
}

type Movie implements Production {
    title: String!
    actors: [Actor!]!
}

type Series implements Production {
    title: String!
    episodes: Int!
    actors: [Actor!]!
}

type Actor {
    name: String!
}
interface Production {
    title: String!
    actors: [Actor!]! @declareRelationship
}

type Movie implements Production {
    title: String!
    actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN)
}

type Series implements Production {
    title: String!
    episodes: Int!
    actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN)
}

type Actor {
    name: String!
}

Edge properties

Edge properties in connections now exist within the field properties in edges:

Before

Now

query ActedInConnection {
  actors {
    actedInConnection {
      edges {
          screenTime
      }
    }
  }
}
query ActedInConnection {
  actors {
    actedInConnection {
      edges {
        properties {
          screenTime
        }
      }
    }
  }
}

_on filters deprecated

_on filters for interfaces are no longer available in where and mutations. To filter by an implementing type, you need to use the new filter typename_IN:

Before

Now

query MyQuery {
  actors(
    where: {
      actedInConnection_SINGLE: { node: { _on: { Movie: { } } } }
    }
  ) {
    name
  }
}
query MyQuery {
 actors(
    where: {
      actedInConnection_SINGLE: { node: { typename_IN: [Movie] } }
    }
  ) {
    name
  }
}

Using fields of a type in an interface operation is no longer supported.

Minimum NodeJS version

With the deprecation of Node 16, the minimum supported NodeJS version is 18.0.0.

experimental flag

The experimental flag is no longer available in the options of the Neo4jGraphQL class.