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
507 stars 149 forks source link

`First` on connection field not taken into account when connected type uses the `@queryOptions` directive #2195

Closed a-alle closed 2 years ago

a-alle commented 2 years ago

Describe the bug Given the following type definitions:

typeDefs = gql`
            type Movie @queryOptions(limit: { default: 3, max: 5 }) {
                id: ID!
                actors: [Person!]! @relationship(type: "ACTED_IN", direction: IN)
            }

            type Person **@queryOptions(limit: { default: 2 })** { 
                id: ID!
            }
        `;

Then the following query:

const query = gql`
                query {
                    movies {
                        id
                        **actorsConnection(first: 4)** {
                            edges {
                                node {
                                    id
                                }
                            }
                        }
                    }
                }
            `;

Is expected to override the default limit of 2 with 4 (coming from the first argument).

However, currently the first argument is being ignored and the default limit option is used, such that 2 actors are being returned.

Expected behavior first argument should override the default limit, but still honour the max limit imposed using @queryOptions directive.

neo4j-team-graphql commented 2 years ago

Many thanks for raising this bug report @a-alle. :bug: We will now attempt to reproduce the bug based on the steps you have provided.

Please ensure that you've provided the necessary information for a minimal reproduction, including but not limited to:

If you have a support agreement with Neo4j, please link this GitHub issue to a new or existing Zendesk ticket.

Thanks again! :pray:

neo4j-team-graphql commented 2 years ago

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

a-alle commented 2 years ago

Completed in https://github.com/neo4j/graphql/pull/2180