neo4j / graphql

A GraphQL to Cypher query execution layer for Neo4j and JavaScript GraphQL implementations.
https://neo4j.com/docs/graphql-manual/current/
Apache License 2.0
504 stars 149 forks source link

Sorting schema should not be generated for cypher fields with NonNullable arguments #5631

Open mjfwebb opened 2 weeks ago

mjfwebb commented 2 weeks ago

Given the following type definitions, schema is generated for sorting on the field custom_string_with_param.

This should not occur as that field takes a NonNullable argument.

type Movie {
    custom_string_with_param(param: String!): String!
        @cypher(statement: "RETURN $param as c", columnName: "c")
}

Excerpt from the schema generated:

            \\"\\"\\"
            Fields to sort Movies by. The order in which sorts are applied is not guaranteed when specifying many fields in one MovieSort object.
            \\"\\"\\"
            input MovieSort {
              custom_string_with_param: SortDirection
            }

We should ensure that custom cypher fields with NonNullable arguments do not have sort schema generated.

neo4j-team-graphql commented 1 day ago

We've been able to confirm this bug using the steps to reproduce that you provided - many thanks @mjfwebb! :pray: We will now prioritise the bug and address it appropriately.