Writing a GraphQL model that programmatically retrieves relevant Neo4j constraints

Writing a GraphQL model that programmatically retrieves relevant Neo4j constraints


0

I am a seasoned Neo4j user who is new to GraphQL. I have inherited a codebase that explicitly models all Neo4j nodes and relationships as GraphQL objects.

I would like to allow GraphQL users to determine what uniqueness constraints, if any, affect any given object.

For an individual object, I believe I can deliver this by doing something like:

type Resource {
    id: BigInt!
    name: String
    category: String
    lastModified: DateTime
    constraints: [String!]! @cypher(statement: "SHOW UNIQUENESS CONSTRAINTS YIELD * WHERE labelsOrTypes=["Resource\"] RETURN properties;")
}

This does not seem efficient, however, and it would be a very redundant hard-coded solution when I have dozens of objects whose type literally represents the label of the given node.

What is the appropriate solution here?

Share
Improve this question


Load 2 more related questions


Show fewer related questions

0

Reset to default



Leave a Reply

Your email address will not be published. Required fields are marked *