Skip to content

Commit 5e9ea87

Browse files
Adds a few missing directives to the index, and fixes some discrepancies (#27)
* Adds a few missing directives to the index, and fixes some discrepancies * Apply suggestions from code review Co-authored-by: Lidia Zuin <[email protected]> --------- Co-authored-by: Lidia Zuin <[email protected]>
1 parent 5796340 commit 5e9ea87

File tree

2 files changed

+19
-38
lines changed

2 files changed

+19
-38
lines changed

modules/ROOT/pages/type-definitions/directives/autogeneration.adoc

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,25 @@ This page describes directives used for autogeneration:
77
[[type-definitions-autogeneration-id]]
88
== `@id`
99

10-
This directive marks a field as the unique identifier for an object type.
11-
By default, that enables autogeneration of IDs for the field and implies that a unique node property constraint should exist for the property.
10+
This directive marks a field as an identifier for an object type.
11+
This enables autogeneration of IDs for the field.
1212

1313
The format of each generated ID is a UUID generated by https://neo4j.com/docs/cypher-manual/current/functions/scalar/#functions-randomuuid[randomUUID() function].
14-
If autogeneration for an ID field is enabled, the field will not be present in input types for mutations.
14+
The field will not be present in input types for mutations.
1515

16-
See xref::/type-definitions/directives/indexes-and-constraints.adoc#type-definitions-constraints-unique[Unique node property constraints] for details on how to assert the existence of the necessary database constraints for relevant fields.
16+
It is recommended to use xref::/type-definitions/directives/indexes-and-constraints.adoc#type-definitions-constraints-unique[`@unique`] in conjunction with this to add a unique node property constraint.
1717

1818
=== Definition
1919

2020
[source, graphql, indent=0]
2121
----
22-
"""Indicates that the field is an identifier for the object type. By default; autogenerated, and has a unique node property constraint in the database."""
23-
directive @id(
24-
autogenerate: Boolean! = true
25-
unique: Boolean! = true
26-
) on FIELD_DEFINITION
22+
"""Indicates that the field is an identifier for the object type."""
23+
directive @id on FIELD_DEFINITION
2724
----
2825

2926
=== Usage
3027

31-
The following two type definitions are equivalent in that they both specify an ID which benefits from autogeneration:
28+
The following type definition specifies the `id` field as an autogenerated value:
3229

3330
[source, graphql, indent=0]
3431
----
@@ -38,34 +35,6 @@ type User {
3835
}
3936
----
4037

41-
[source, graphql, indent=0]
42-
----
43-
type User {
44-
id: ID! @id(autogenerate: true)
45-
username: String!
46-
}
47-
----
48-
49-
The following type definition is currently a no-op, as the `@id` directive only provides autogeneration as it stands:
50-
51-
[source, graphql, indent=0]
52-
----
53-
type User {
54-
id: ID! @id(autogenerate: false)
55-
username: String!
56-
}
57-
----
58-
59-
You can disable the mapping of the `@id` directive to a unique node property constraint by setting the `unique` argument to `false`:
60-
61-
[source, graphql, indent=0]
62-
----
63-
type User {
64-
id: ID! @id(unique: false)
65-
username: String!
66-
}
67-
----
68-
6938
[[type-definitions-autogeneration-timestamp]]
7039
== `@timestamp`
7140

modules/ROOT/pages/type-definitions/directives/index.adoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ The Neo4j GraphQL Library provides the following directives to be used whilst de
1111
| xref::/type-definitions/directives/database-mapping.adoc#type-definitions-alias[`@alias`]
1212
| Maps a GraphQL schema field to a Neo4j property on a node or relationship.
1313

14+
| xref::/authentication-and-authorization/authentication.adoc[`@authentication`]
15+
| Requires authentication checks when accessing the type.
16+
17+
| xref::/authentication-and-authorization/authorization.adoc[`@authorization`]
18+
| Specifies authorization rules for queries and mutations on the type.
19+
1420
| xref::/type-definitions/directives/default-values.adoc#type-definitions-default-values-coalesce[`@coalesce`]
1521
| Exposes a mechanism for querying against non-existent, `null` values on a node.
1622

@@ -68,6 +74,9 @@ Can only be used on interfaces, as per its definition:
6874
directive @relationshipProperties on INTERFACE
6975
----
7076

77+
| `@relayId`
78+
| Specifies that the field should be used as the global node identifier for Relay.
79+
7180
| xref:/schema-configuration/field-configuration.adoc#_selectable[`@selectable`]
7281
| Sets the availability of fields on queries and aggregations.
7382

@@ -77,6 +86,9 @@ directive @relationshipProperties on INTERFACE
7786
| xref:/schema-configuration/type-configuration.adoc#_subscription[`@subscription`]
7887
| Limits subscription operations in the library.
7988

89+
| `@subscriptionsAuthorization`
90+
| Specifies authorization rules for subscriptions on the type.
91+
8092
| xref::/type-definitions/directives/autogeneration.adoc#type-definitions-autogeneration-timestamp[`@timestamp`]
8193
| Flags fields to be used to store timestamps on create/update events.
8294

0 commit comments

Comments
 (0)