Skip to content

Array methods do not raise an error on relationship properties. #5766

Open
@MacondoExpress

Description

@MacondoExpress

Describe the bug
The array methodz _PUSH/ _POP do not raise an error when the array is not initialized; this happens only on relationship properties, while a proper error is raised on node properties.

Type definitions

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

type ActedIn @relationshipProperties {
    stuffs: [Int!]
}

type Actor {
    name: String
    movies: Movie! @relationship(type: "ACTED_IN", direction: OUT, properties: "ActedIn")
}

To Reproduce
The below mutation does not raise an error:

mutation MyMutation {
  updateMovies(update: { actors: { update: { edge: { stuffs_PUSH: 10 } } } }) {
    movies {
      actors {
        name
      }
    }
  }
}

The following will raise an error:

mutation MyMutation {
  updateMovies(update: { stuffs_PUSH: 1 }) {
    movies {
      actors {
        name
      }
    }
  }
}

Error

{
  "errors": [
    {
      "message": "Failed to invoke function `apoc.util.validatePredicate`: Caused by: java.lang.RuntimeException: Property stuffs cannot be NULL",
      "locations": [{ "line": 2, "column": 3 }],
      "path": ["updateMovies"]
    }
  ],
  "data": null
}

Expected behavior
A consistent behavior with an error that is raised, currently one mutation does not raise an error and at the same time, the property is not correctly mutated.

System (please complete the following information):

  • OS: [ macOS]
  • Version: [@neo4j/graphql@5.0.0]
  • Node.js version: [22.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconfirmedConfirmed bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions