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

Global schema configuration not working #4157

Closed eriklueth closed 8 months ago

eriklueth commented 1 year ago

Describe the bug In your Global schema configuration Docs you describe that all queries and mutations can be turned of via:

  gql`
    extend schema
      @query(read: false, aggregate: false)
      @mutation(operations: [])
  `,

When I add this to our schema nothing happens and all queries and mutations are still there. I think we have added it correctly since when I have some @query or @mutation still added to some individual type we get the error:

  GraphQLError: Invalid directive usage: Directive @mutation can only be used in one location: either schema or type.

I would expect that adding the extend schema stuff it will turn off all autogenerated queries or mutations and just the custom queries and mutations should be shown, but it still shows everything.

neo4j-team-graphql commented 1 year ago

Many thanks for raising this bug report @eriklueth. :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 1 year ago

Many thanks for raising this bug report @eriklueth. :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:

darrellwarde commented 1 year ago

I can't reproduce this, in the Toolbox anyway. What situation does this happen in?

darrellwarde commented 1 year ago

@eriklueth, any update on the above?

eriklueth commented 1 year ago

Hey @darrellwarde, Sorry for not providing better reproductions in the past... I finally had the time to create a repository that I can use to share reproducible bugs with you guys. https://github.com/eriklueth/test-backend.git

In Ticket.ts I added the extend schema but when I run the server all the queries are still generated.

I wish you a nice weekend. 😊

a-alle commented 1 year ago

Hi @eriklueth, I am trying to reproduce your issue however I am unable to. The repository you linked above does not compile because it's missing the "qrcode" module. I tried creating a server using a list of the 2 type definitions from Linktree and Ticket and I'm only getting the custom Query and Mutation, no autogenerated operations. In order to get to the bottom of this, would you please be able to send across a minimal reproducible example?

lewisparma commented 11 months ago

I reproduced the same issue. In my case the reason was that I called OGM.init() before calling the Neo4jGraphQL.getSchema(). If I change the order the issue goes away

mjfwebb commented 9 months ago

I reproduced the same issue. In my case the reason was that I called OGM.init() before calling the Neo4jGraphQL.getSchema(). If I change the order the issue goes away

Hi @lewisparma I can't seem to reproduce this. Do you have a small code reproduction we can use?

angrykoala commented 8 months ago

Closing this as it is unreproducible for a while, @eriklueth and @lewisparma feel free to comment here if there is more information that may help us reproduce the issue