|
| 1 | +[[directives]] |
| 2 | += Directives |
| 3 | +:description: This page lists all directives available in the Neo4j GraphQL Library. |
| 4 | + |
| 5 | + |
| 6 | +The Neo4j GraphQL Library provides the following directives to be used whilst defining types: |
| 7 | + |
| 8 | +== Database mapping |
| 9 | + |
| 10 | +[cols="2,5"] |
| 11 | +|=== |
| 12 | +| Directive | Description |
| 13 | + |
| 14 | +| xref::/directives/database-mapping.adoc#_relationship[`@relationship`] |
| 15 | +| Configures xref::/types/relationships.adoc[relationships] between object types. |
| 16 | + |
| 17 | +| xref::/directives/database-mapping.adoc#_relationship_properties[`@relationshipProperties`] |
| 18 | +a| Required to differentiate interfaces that are used for relationship properties, and otherwise. |
| 19 | + |
| 20 | +| xref::/directives/database-mapping.adoc#type-definitions-node[`@node`] |
| 21 | +| Specifies the configuration of a GraphQL object type which represents a Neo4j node. |
| 22 | + |
| 23 | +| xref::/directives/database-mapping.adoc#type-definitions-alias[`@alias`] |
| 24 | +| Maps a GraphQL schema field to a Neo4j property on a node or relationship. |
| 25 | + |
| 26 | +| xref::/directives/database-mapping.adoc#_declarerelationship[`@declareRelationship`] |
| 27 | +| Configure xref::/types/relationships.adoc[relationships] to be implemented on object types. |
| 28 | + |
| 29 | +|=== |
| 30 | + |
| 31 | +== Security |
| 32 | + |
| 33 | +[cols="2,5"] |
| 34 | +|=== |
| 35 | +| Directive | Description |
| 36 | + |
| 37 | +| xref::/directives/security/authentication.adoc[`@authentication`] |
| 38 | +| Requires authentication checks when accessing the type. |
| 39 | + |
| 40 | +| xref::/directives/security/authorization.adoc[`@authorization`] |
| 41 | +| Specifies authorization rules for queries and mutations on the type. |
| 42 | + |
| 43 | +| xref::/directives/security/configuration.adoc#authentication-and-authorization-jwt[`@jwt`] |
| 44 | +| Configure the JWT authentication filter to include an additional JWT claim. |
| 45 | + |
| 46 | +| xref::/directives/security/configuration.adoc#_nested_claims[`@jwtClaim`] |
| 47 | +| Use in combination with `@jwt`. |
| 48 | +Configures the JWT authentication filter to include an additional nested JWT claim. |
| 49 | + |
| 50 | +| `@subscriptionsAuthorization` |
| 51 | +| Specifies authorization rules for subscriptions on the type. |
| 52 | + |
| 53 | +|=== |
| 54 | + |
| 55 | +== Autogeneration |
| 56 | + |
| 57 | +[cols="2,5"] |
| 58 | +|=== |
| 59 | +| Directive | Description |
| 60 | + |
| 61 | +| xref::/directives/autogeneration.adoc#type-definitions-autogeneration-id[`@id`] |
| 62 | +| Marks a field as the unique ID for an object type, and allows for autogeneration of IDs. |
| 63 | + |
| 64 | +| xref::/directives/autogeneration.adoc#type-definitions-autogeneration-timestamp[`@timestamp`] |
| 65 | +| Flags fields to be used to store timestamps on `create` and `update` events. |
| 66 | + |
| 67 | +|=== |
| 68 | + |
| 69 | +== Schema configuration |
| 70 | + |
| 71 | +[cols="2,5"] |
| 72 | +|=== |
| 73 | +| Directive | Description |
| 74 | + |
| 75 | +| xref:/directives/schema-configuration/type-configuration.adoc#_query[`@query`] |
| 76 | +| Limits the availability of query operations in the library. |
| 77 | + |
| 78 | +| xref:/directives/schema-configuration/type-configuration.adoc#_mutation[`@mutation`] |
| 79 | +| Limits the availability of Mutation operations in the library. |
| 80 | + |
| 81 | +| xref:/directives/schema-configuration/type-configuration.adoc#_subscription[`@subscription`] |
| 82 | +| Limits subscription operations in the library. |
| 83 | + |
| 84 | +| xref::/directives/schema-configuration/type-configuration.adoc#type-definitions-default-values-default[`@default`] |
| 85 | +| Allows the setting of a default value for a field during object creation. |
| 86 | + |
| 87 | +| xref::/directives/schema-configuration/type-configuration.adoc#type-definitions-plural[`@plural`] |
| 88 | +| Redefines how to compose the plural of the type for the generated operations. |
| 89 | +Particularly useful for types that are not correctly pluralized or are non-English words. |
| 90 | + |
| 91 | +| xref:/directives/schema-configuration/field-configuration.adoc#_selectable[`@selectable`] |
| 92 | +| Sets the availability of fields on queries and aggregations. |
| 93 | + |
| 94 | +| xref:/directives/schema-configuration/field-configuration.adoc#_settable[`@settable`] |
| 95 | +| Sets the availability of fields on the `create` and `update` inputs. |
| 96 | + |
| 97 | +| xref:/directives/schema-configuration/field-configuration.adoc#_filterable[`@filterable`] |
| 98 | +| Defines the filters generated for a field. |
| 99 | + |
| 100 | +|=== |
| 101 | + |
| 102 | +== Indexes and constraints |
| 103 | + |
| 104 | +[cols="2,5"] |
| 105 | +|=== |
| 106 | +| Directive | Description |
| 107 | + |
| 108 | +| xref::/directives/indexes-and-constraints.adoc#type-definitions-indexes-fulltext[`@fulltext`] |
| 109 | +| Indicates that there should be a fulltext index inserted into the database for the specified Node and its properties. |
| 110 | + |
| 111 | +| xref::/directives/indexes-and-constraints.adoc#type-definitions-constraints-unique[`@unique`] |
| 112 | +| Indicates that there should be a uniqueness constraint in the database for the fields that it is applied to. |
| 113 | + |
| 114 | +|=== |
| 115 | + |
| 116 | +== Custom logic |
| 117 | + |
| 118 | +[cols="2,5"] |
| 119 | +|=== |
| 120 | +| Directive | Description |
| 121 | + |
| 122 | +| xref::/directives/custom-logic.adoc#_cypher[`@cypher`] |
| 123 | +| Overrides field resolution (including query and mutation fields), instead resolving with the specified Cypher. |
| 124 | + |
| 125 | +| xref::/directives/custom-logic.adoc#_coalesce[`@coalesce`] |
| 126 | +| Exposes a mechanism for querying against non-existent, `null` values on a node. |
| 127 | + |
| 128 | +| xref::/directives/custom-logic.adoc#_limit[`@limit`] |
| 129 | +| Used on nodes to inject values into Cypher `LIMIT` clauses. |
| 130 | + |
| 131 | +| xref::/directives/custom-logic.adoc#_customresolver[`@customResolver`] |
| 132 | +| Specifies that a field is resolved by a custom resolver, and allows the specification |
| 133 | +of any required fields that is passed as arguments to the custom resolver. |
| 134 | + |
| 135 | +| xref::/directives/custom-logic.adoc#_populatedby[`@populatedBy`] |
| 136 | +| Specifies a callback function (executed during GraphQL query parsing) to populate fields which have not been provided within the input. |
| 137 | + |
| 138 | +|=== |
| 139 | + |
| 140 | +== OGM |
| 141 | + |
| 142 | +[cols="2,5"] |
| 143 | +|=== |
| 144 | +| Directive | Description |
| 145 | + |
| 146 | +| xref::ogm/directives.adoc#_private[`@private`] |
| 147 | +| Protects fields which should only be available through the xref::ogm/index.adoc[OGM]. |
| 148 | + |
| 149 | +|=== |
| 150 | + |
| 151 | +== Relay |
| 152 | + |
| 153 | +[cols="2,5"] |
| 154 | +|=== |
| 155 | +| Directive | Description |
| 156 | + |
| 157 | +| xref:/integrations/relay-compatibility.adoc[`@relayId`] |
| 158 | +| Specifies that the field should be used as the global node identifier for Relay. |
| 159 | + |
| 160 | +|=== |
0 commit comments