You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that the LongType included with the SchemaDefinition implementation is not actually supported. If I define a mutation field in my schema with input type LongType, like this:
{
"documentId": -105406704,
"errors": [
{
"message": "Argument field or value named 'addressId' can not be coerced. It does not match a valid literal representation for the type.",
"path": [
"createContactInformationWithAddressId"
],
"extensions": {
"kind": "Validation"
}
}
]
}
| IntValue _ ->
match tref.Name, tref.Kind with
| Some ("ID" | "Int" | "Float"), TypeKind.SCALAR -> Success
| _ -> canNotCoerce
where the input literal is interpreted as an IntType, which is fine, but this code doesn't allow for coercion to LongType. The coercion functions do exist (here, for example:
{
"documentId": -2060341738,
"errors": [
{
"message": "Inline value '1' of type string cannot be converted into integer of range from -9223372036854775808 to 9223372036854775807",
"extensions": {
"kind": "InputCoercion",
"path": [
"addressId"
],
"argumentName": "contactInformation",
"argumentType": "ContactInformationWithAddressIdInput!",
"objectType": "ContactInformationWithAddressIdInput!",
"fieldType": "Long!"
}
}
]
}
This is even more confusing, because the validation code seems to be ok with strings here, but I didn't quite see how it should get over to the actual coercion functions defined in the schema.
Expected behavior
Integer literals should be coercible to LongType
Actual behavior
LongType is filtered out by the cited code above.
Known workarounds
Can use IntType, potentially, in the input object definition.
Related information
Operating system: Windows 11
Branch: master (or whatever is published to Nuget)
.NET Runtime, CoreCLR or Mono Version: .NET SDK 8.0.303
The text was updated successfully, but these errors were encountered:
Description
It appears that the
LongType
included with the SchemaDefinition implementation is not actually supported. If I define a mutation field in my schema with input typeLongType
, like this:things build just fine, but when I try to post a mutation using this, it fails in the validation phase before it ever gets to my code.
The resulting error:
This appears to be cause by this code:
https://github.com/fsprojects/FSharp.Data.GraphQL/blob/d96b065b95d553cdaac68cd2697490c5b618be44/src/FSharp.Data.GraphQL.Shared/Validation.fs#L920C1-L923C36
where the input literal is interpreted as an
IntType
, which is fine, but this code doesn't allow for coercion toLongType
. The coercion functions do exist (here, for example:FSharp.Data.GraphQL/src/FSharp.Data.GraphQL.Shared/SchemaDefinitions.fs
Line 79 in d96b065
I tried working around this by wrapping the value in quotes:
The resulting error:
Error:
This is even more confusing, because the validation code seems to be ok with strings here, but I didn't quite see how it should get over to the actual coercion functions defined in the schema.
Expected behavior
Integer literals should be coercible to
LongType
Actual behavior
LongType
is filtered out by the cited code above.Known workarounds
Can use
IntType
, potentially, in the input object definition.Related information
master
(or whatever is published to Nuget)The text was updated successfully, but these errors were encountered: