cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to generate typeDefs from existing Neo4J database with help of some tool or some mean?

I want to use Neo4jGraphQL library and have one existing Neo4J database. Is there a way to generate typeDefs out of the box using using some tool or some mean?

const { Neo4jGraphQL } = require("@neo4j/graphql");

const neo4j = require("neo4j-driver");

const typeDefs = gql`

type User {

username: String

orders: [Order!]! @relationship(type: "PLACED", direction: OUT)

}

1 ACCEPTED SOLUTION

The older neo4j-graphql-js had an automatic schema generation feature, but it hasn't been included in @neo4j/graphql yet.

In the meantime, what you can do in your Neo4j instance is run these two queries:

CALL apoc.meta.nodeTypeProperties();
CALL apoc.meta.relTypeProperties();

These will give you complete reports of all of the metadata in the database. It isn't a GraphQL set of typedefs, but you can translate it into typedefs. (This is how the feature in neo4j-graphql-js worked)

View solution in original post

2 REPLIES 2

The older neo4j-graphql-js had an automatic schema generation feature, but it hasn't been included in @neo4j/graphql yet.

In the meantime, what you can do in your Neo4j instance is run these two queries:

CALL apoc.meta.nodeTypeProperties();
CALL apoc.meta.relTypeProperties();

These will give you complete reports of all of the metadata in the database. It isn't a GraphQL set of typedefs, but you can translate it into typedefs. (This is how the feature in neo4j-graphql-js worked)

Thank you very much David.