Skip to content

Commit 3be10e8

Browse files
committed
Added a description to the pagination arguments.
Replicates graphql/graphql-relay-js@02a5a27
1 parent 4251af6 commit 3be10e8

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

Diff for: src/graphql_relay/connection/connection.py

+17-4
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,28 @@
3737
# Returns a GraphQLArgumentMap appropriate to include on a field
3838
# whose return type is a connection type with forward pagination.
3939
forward_connection_args: GraphQLArgumentMap = {
40-
"after": GraphQLArgument(GraphQLString),
41-
"first": GraphQLArgument(GraphQLInt),
40+
"after": GraphQLArgument(
41+
GraphQLString,
42+
description="Returns the items in the list"
43+
" that come after the specified cursor.",
44+
),
45+
"first": GraphQLArgument(
46+
GraphQLInt,
47+
description="Returns the first n items from the list.",
48+
),
4249
}
4350

4451
# Returns a GraphQLArgumentMap appropriate to include on a field
4552
# whose return type is a connection type with backward pagination.
4653
backward_connection_args: GraphQLArgumentMap = {
47-
"before": GraphQLArgument(GraphQLString),
48-
"last": GraphQLArgument(GraphQLInt),
54+
"before": GraphQLArgument(
55+
GraphQLString,
56+
description="Returns the items in the list"
57+
" that come before the specified cursor.",
58+
),
59+
"last": GraphQLArgument(
60+
GraphQLInt, description="Returns the last n items from the list."
61+
),
4962
}
5063

5164
# Returns a GraphQLArgumentMap appropriate to include on a field

Diff for: tests/connection/test_connection.py

+27-3
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,33 @@ def generates_correct_types():
188188
189189
type User {
190190
name: String
191-
friends(after: String, first: Int, before: String, last: Int): FriendConnection
192-
friendsForward(after: String, first: Int): UserConnection
193-
friendsBackward(before: String, last: Int): UserConnection
191+
friends(
192+
"""Returns the items in the list that come after the specified cursor."""
193+
after: String
194+
195+
"""Returns the first n items from the list."""
196+
first: Int
197+
198+
"""Returns the items in the list that come before the specified cursor."""
199+
before: String
200+
201+
"""Returns the last n items from the list."""
202+
last: Int
203+
): FriendConnection
204+
friendsForward(
205+
"""Returns the items in the list that come after the specified cursor."""
206+
after: String
207+
208+
"""Returns the first n items from the list."""
209+
first: Int
210+
): UserConnection
211+
friendsBackward(
212+
"""Returns the items in the list that come before the specified cursor."""
213+
before: String
214+
215+
"""Returns the last n items from the list."""
216+
last: Int
217+
): UserConnection
194218
}
195219
196220
"""A connection to a list of items."""

0 commit comments

Comments
 (0)