Skip to content

Commit 01eafce

Browse files
Copilotxperiandri
andauthored
Fix Long scalar inline integer validation and add regression test
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/63f68819-566d-4fd8-b346-9f4ea5c8f2c9 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
1 parent 61e728f commit 01eafce

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/FSharp.Data.GraphQL.Shared/Validation.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ module Ast =
920920
| _ when tref.Kind = TypeKind.NON_NULL -> checkIsCoercible tref.OfType.Value argName value
921921
| IntValue _ ->
922922
match tref.Name, tref.Kind with
923-
| Some ("ID" | "Int" | "Float"), TypeKind.SCALAR -> Success
923+
| Some ("ID" | "Int" | "Long" | "Float"), TypeKind.SCALAR -> Success
924924
| _ -> canNotCoerce
925925
| FloatValue _ ->
926926
match tref.Name, tref.Kind with

tests/FSharp.Data.GraphQL.Tests/AstValidationTests.fs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ let Arguments =
219219
[ Define.Input ("intArg", Nullable IntType) ],
220220
(fun ctx _ -> ctx.Arg ("intArg"))
221221
)
222+
Define.Field (
223+
"longArgField",
224+
Nullable LongType,
225+
[ Define.Input ("longArg", Nullable LongType) ],
226+
(fun ctx _ -> ctx.Arg ("longArg"))
227+
)
222228
Define.Field (
223229
"nonNullBooleanListField",
224230
ListOf BooleanType,
@@ -1020,6 +1026,10 @@ fragment coercedIntIntoFloatArg on Arguments {
10201026
floatArgField(floatArg: 123)
10211027
}
10221028
1029+
fragment coercedIntIntoLongArg on Arguments {
1030+
longArgField(longArg: 123)
1031+
}
1032+
10231033
query goodComplexDefaultValue($search: ComplexInput = { name: "Fido" }) {
10241034
findDog(complex: $search)
10251035
}"""

0 commit comments

Comments
 (0)