How do I update my GraphQL schemas directly from neo4j?

I'm using the GraphQL plugin for my Neo4j Desktop (https://github.com/neo4j-graphql/neo4j-graphql) and it was working great until recently. I realized I needed a new relationship between two different node types, and after I ran the cypher to create the new relationships in the database, I restarted the database/server via the Neo4j Desktop app, but I'm not seeing any update to the schema (which I'm accessing via GraphiQL on my desktop.

Any ideas about what I should do, or can you point me to resources I should read before bugging people here. I'm not a very sophisticated developer, so it's not entirely unlikely I'm missing something obvious.

I have run: call graphql.idl(null) a couple of times

thanks in advance!

Just for future reference, GraphQL != GQL, since GQL is the name of the Graph Query Language initiative to create a standard graph query language.

1 Like

Thanks, I appreciate the heads up, although at this point it seems like name collision is a thing. After all, GraphQL stands for Graph Query Language.

Hey @daniel.harrison -

If you run RETURN graphql.getIdl() do you see the new relationships in the type definitions?

You can also explicitly add to the GraphQL type definitions by taking the result of RETURN graphql.getIdl(), modifying it to include the relationship fields you want to add and sending those new type definitions (as a string) in CALL graphql.idl(<TYPE DEFS HERE>)

Thanks @William_Lyon. I enjoyed your video on using the Neo4j-GraphQL plugin with Neo4 desktop, btw.

I'll try that. It seems that vigorous turning it off and turning it on again has helped a bit, since I can now get some of the new relationships. I'm still having difficulty getting it to return an array of objects rather than a single object when it's a many-to-many relationship, but I'll keep at it. Thanks for the suggestions.

Hi @William_Lyon, I tried your idea of getting the schema, fixing it in my editor, and returning it to the graphQL server, but am running into some errors.

One of the main changes I want to make is turning a linked item from a one-to-many into a many-to-many relationship. If, let's say, "employs" is a property of the Company type, can I just throw some square brackets around the word Person at the end of the employs property like go from "...): Person" to "... ): [Person]"? Or is there more I'll have to do?

I don't want to make you explain GraphQL or anything else that's fairly well documented, so any links you can provide would be much appreciated. On which topic, if you've got a list of the procedures I can call on the graphql plugin, it'd be a great help.

thanks!

@William_Lyon, I've been reading a lot of your tutorials and notes on this tool, and thank you for it! I can't work out if there's a way to update portions of the schema.

Also, I'm still not getting it to work when I upload a new schema with the changes I want. Is there a cache I have to dump or something else I might be missing?

Thanks again!

Hey @daniel.harrison - if you're using the database plugin you'll need to pass the entire schema each time you run CALL graphql.idl(...), there is not an option for partially updating the type definitions.

Do you have the most recent version of the plugin (v3.5.0.4)? There was an improvement for handling updates to the type definitions.