Skip to content

Commit 945c831

Browse files
Copilotxperiandri
andauthored
Revert Connections wrapper helper inference changes
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/df69f52d-8893-4c50-83c4-10a37ad534cb Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
1 parent 9273074 commit 945c831

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

src/FSharp.Data.GraphQL.Server.Relay/Connections.fs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ type SliceInfo<'Cursor> =
114114

115115
[<AutoOpen>]
116116
module Definitions =
117+
let inline private nullableOutput (innerDef : #OutputDef<'Val>) : OutputDef<'Val option> =
118+
Nullable (innerDef :> OutputDef<'Val>)
117119

118120
/// <summary>
119121
/// Active pattern that extracts Relay pagination arguments from a GraphQL field context.
@@ -159,13 +161,13 @@ module Definitions =
159161
)
160162
Define.AsyncField (
161163
"startCursor",
162-
Nullable StringType,
164+
nullableOutput StringType,
163165
"When paginating backwards, the cursor to continue.",
164166
fun _ pageInfo -> pageInfo.StartCursor
165167
)
166168
Define.AsyncField (
167169
"endCursor",
168-
Nullable StringType,
170+
nullableOutput StringType,
169171
"When paginating forwards, the cursor to continue.",
170172
fun _ pageInfo -> pageInfo.EndCursor
171173
)
@@ -225,7 +227,7 @@ module Definitions =
225227
fields = [
226228
Define.AsyncField (
227229
"totalCount",
228-
Nullable IntType,
230+
nullableOutput IntType,
229231
"""A count of the total number of objects in this connection, ignoring pagination. This allows a client to fetch the first five objects by passing \"5\" as the argument to `first`, then fetch the total count so it could display \"5 of 83\", for example. In cases where we employ infinite scrolling or don't have an exact count of entries, this field will return `null`.""",
230232
fun _ conn -> conn.TotalCount
231233
)
@@ -276,6 +278,8 @@ module Edge =
276278

277279
[<RequireQualifiedAccess>]
278280
module Connection =
281+
let inline private nullableInput (innerDef : #InputDef<'Val>) : InputDef<'Val option> =
282+
Nullable (innerDef :> InputDef<'Val>)
279283

280284
/// <summary>
281285
/// Transforms a <see cref="Connection{T}"/> into a <see cref="Connection{U}"/>
@@ -304,8 +308,8 @@ module Connection =
304308
/// <seealso cref="backwardArgs"/>
305309
/// <seealso cref="allArgs"/>
306310
let forwardArgs =
307-
[ Define.Input ("first", Nullable IntType)
308-
Define.Input ("after", Nullable StringType) ]
311+
[ Define.Input ("first", nullableInput IntType)
312+
Define.Input ("after", nullableInput StringType) ]
309313

310314
/// <summary>
311315
/// Argument definitions for backward pagination ("last" and "before").
@@ -314,8 +318,8 @@ module Connection =
314318
/// <seealso cref="forwardArgs"/>
315319
/// <seealso cref="allArgs"/>
316320
let backwardArgs =
317-
[ Define.Input ("last", Nullable IntType)
318-
Define.Input ("before", Nullable StringType) ]
321+
[ Define.Input ("last", nullableInput IntType)
322+
Define.Input ("before", nullableInput StringType) ]
319323

320324
/// <summary>
321325
/// Complete set of argument definitions for bidirectional pagination.

0 commit comments

Comments
 (0)