From 02a5a27c73924a5073e89679d9aa47eb6aedd590 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Mon, 31 May 2021 12:47:54 +0300 Subject: [PATCH] Added a description to the pagination arguments. (#330) --- src/connection/__tests__/connection-test.js | 30 ++++++++++++++++++--- src/connection/connection.js | 6 +++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/connection/__tests__/connection-test.js b/src/connection/__tests__/connection-test.js index 5642f64..54548ed 100644 --- a/src/connection/__tests__/connection-test.js +++ b/src/connection/__tests__/connection-test.js @@ -189,9 +189,33 @@ describe('connectionDefinition()', () => { type User { name: String - friends(after: String, first: Int, before: String, last: Int): FriendConnection - friendsForward(after: String, first: Int): UserConnection - friendsBackward(before: String, last: Int): UserConnection + friends( + """Returns the items in the list that come after the specified cursor.""" + after: String + + """Returns the first n items from the list.""" + first: Int + + """Returns the items in the list that come before the specified cursor.""" + before: String + + """Returns the last n items from the list.""" + last: Int + ): FriendConnection + friendsForward( + """Returns the items in the list that come after the specified cursor.""" + after: String + + """Returns the first n items from the list.""" + first: Int + ): UserConnection + friendsBackward( + """Returns the items in the list that come before the specified cursor.""" + before: String + + """Returns the last n items from the list.""" + last: Int + ): UserConnection } """A connection to a list of items.""" diff --git a/src/connection/connection.js b/src/connection/connection.js index fba683f..b988736 100644 --- a/src/connection/connection.js +++ b/src/connection/connection.js @@ -21,9 +21,12 @@ import type { export const forwardConnectionArgs: GraphQLFieldConfigArgumentMap = { after: { type: GraphQLString, + description: + 'Returns the items in the list that come after the specified cursor.', }, first: { type: GraphQLInt, + description: 'Returns the first n items from the list.', }, }; @@ -34,9 +37,12 @@ export const forwardConnectionArgs: GraphQLFieldConfigArgumentMap = { export const backwardConnectionArgs: GraphQLFieldConfigArgumentMap = { before: { type: GraphQLString, + description: + 'Returns the items in the list that come before the specified cursor.', }, last: { type: GraphQLInt, + description: 'Returns the last n items from the list.', }, };