Skip to content

Commit 94ca419

Browse files
darrellwardelidiazuin
authored andcommitted
Update @queryOptions to @limit and add migration step (neo4j#19)
1 parent 2a1a74e commit 94ca419

File tree

3 files changed

+34
-22
lines changed

3 files changed

+34
-22
lines changed

modules/ROOT/pages/directives/default-values.adoc

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,27 +74,23 @@ type Movie {
7474
}
7575
----
7676

77-
[[type-definitions-default-values-queryoptions]]
78-
== `@queryOptions`
77+
[[type-definitions-default-values-limit]]
78+
== `@limit`
7979

80-
The `@queryOptions` is to be used on nodes, where applied will inject values into a query such as the `limit`.
80+
The `@limit` is to be used on nodes, where applied will inject values into a query such as the `limit`.
8181

8282
=== Definition
8383

8484
[source, graphql, indent=0]
8585
----
86-
"""The `@queryOptions` is to be used on nodes, where applied will inject values into a query such as the `limit`."""
87-
directive @queryOptions(
88-
"""If no limit argument is supplied on query will fallback to this value."""
89-
limit: {
90-
default: Int
91-
max: Int
92-
}
86+
"""The `@limit` is to be used on nodes, where applied will inject values into a query such as the `limit`."""
87+
directive @limit(
88+
default: Int
89+
max: Int
9390
) on OBJECT
9491
----
9592

96-
=== Limit
97-
Limit has 2 arguments:
93+
The directive has two arguments:
9894

9995
* `default` - If no `limit` argument is passed to the query, the default limit will be used. The query may still pass a higher or lower `limit`.
10096
* `max` - Defines the maximum limit to be passed to the query. If a higher value is passed, this will be used instead. If no `default` value is set, `max` will be used for queries without limit.

modules/ROOT/pages/directives/reference.adoc

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ The `@id` directive marks a field as the unique ID for an object type, and allow
6262

6363
Reference: xref::/directives/autogeneration.adoc#type-definitions-autogeneration-id[`@id`]
6464

65+
== `@limit`
66+
67+
The `@limit` is to be used on nodes, and when applied will inject values into Cypher `LIMIT` clauses.
68+
69+
Reference: xref::reference/directives/default-values.adoc#type-definitions-default-values-limit[`@limit`]
70+
6571
== `@mutation`
6672

6773
This directive is used to limit the availability of Mutation operations in the library.
@@ -102,16 +108,6 @@ This directive is used to limit the availability of Query operations in the libr
102108

103109
Reference: xref:/schema-configuration/type-configuration.adoc#_query[`@query`]
104110

105-
== `@queryOptions`
106-
107-
The `@queryOptions` is to be used on nodes, where applied will inject values into a query such as the `limit`.
108-
109-
<<<<<<< HEAD:modules/ROOT/pages/directives/reference.adoc
110-
Reference: xref::/directives/default-values.adoc#type-definitions-default-values-queryoptions[`@queryOptions`]
111-
=======
112-
Reference: xref::reference/directives/default-values.adoc#type-definitions-default-values-queryoptions[`@queryOptions`]
113-
>>>>>>> dd84992 (Remove references to deprecated directives (#11)):modules/ROOT/pages/reference/directives/index.adoc
114-
115111
== `@relationship`
116112

117113
The `@relationship` directive is used to configure relationships between object types.

modules/ROOT/pages/migration/v4-migration/index.adoc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,26 @@ However, if using TypeScript, the exported interface to implement these classes
161161

162162
We have renamed a number of directives and their arguments, in order to make using `@neo4j/graphql` more intuitive.
163163

164+
=== `@queryOptions` removed and `limit` argument moved to `@limit`
165+
166+
If you were using the `@queryOptions` directive to configure the default and max values for limiting the data returned by queries, for instance:
167+
168+
[source, graphql, indent=0]
169+
----
170+
type Record @queryOptions(limit: { default: 10, max: 100 }) {
171+
id: ID!
172+
}
173+
----
174+
175+
This is now achieved by using the `@limit` directive:
176+
177+
[source, graphql, indent=0]
178+
----
179+
type Record @limit(default: 10, max: 100) {
180+
id: ID!
181+
}
182+
----
183+
164184
[populatedBy-migration]
165185
=== `@callback` renamed to `@populatedBy`
166186

0 commit comments

Comments
 (0)