This page provides an overview of the various GraphQL schema directives made available in neo4j-graphql.js. See the links in the table below for full documentation of each directive.
What Are GraphQL Schema Directives
GraphQL schema directives are a powerful feature of GraphQL that can be used in the type definitions of a GraphQL schema to indicate non-default logic and can be applied to either fields on types. Think of a schema directive as a way to indicate custom logic that should be executed on the GraphQL server.
In neo4j-graphql.js we use schema directives to:
- help describe our data model (
- implement custom logic in our GraphQL service (
- help implement authorization logic (
Neo4j GraphQL Schema Directives
The following GraphQL schema directives are declared during the schema augmentation process and can be used in the type definitions passed to
|Used to define relationship fields and types in the GraphQL schema||See Designing Your GraphQL Schema Guide|
|Used to define custom logic using Cypher||See Defining Custom Logic, and Designing Your GraphQL Schema|
|Used to exclude fields or types from the Cypher query generation process. Use when implementing a custom resolver.||See Defining Custom Logic|
|Used for adding additional node labels to types. Can be useful for multi-tenant scenarios where an additional node label is used per tenant.||See GraphQL Authorization|
|Protects fields and types by requiring a valid signed JWT||See GraphQL Authorization|
|Protects fields and types by limiting access to only requests with valid roles||See GraphQL Authorization|
|Protects fields and types by limiting access to only requests with valid scopes||See GraphQL Authorization|