Skip to content

Commit d3ace82

Browse files
authored
Update @queryOptions to @limit and add migration step (#19)
1 parent 4b05346 commit d3ace82

File tree

3 files changed

+34
-18
lines changed

3 files changed

+34
-18
lines changed

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

modules/ROOT/pages/reference/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/reference/directives/index.adoc

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

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

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

6672
This directive is used to limit the availability of Mutation operations in the library.
@@ -101,12 +107,6 @@ This directive is used to limit the availability of Query operations in the libr
101107

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

104-
== `@queryOptions`
105-
106-
The `@queryOptions` is to be used on nodes, where applied will inject values into a query such as the `limit`.
107-
108-
Reference: xref::reference/directives/default-values.adoc#type-definitions-default-values-queryoptions[`@queryOptions`]
109-
110110
== `@relationship`
111111

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

0 commit comments

Comments
 (0)