Unable to create BigInt scalar
Both main and next does not really allow to implement custom scalars that cannot be represented by Value type. One example would be BigInt scalar. I should be possible to implement custom storage/serialize/deserialize for user defined scalars.
The GraphQL spec was a little vague about custom scalars, IIRC. I think it said something about how they always have to be able to serialize to a string, but things like JSON objects work too for examples like the geo-coordinates.
In this case, wouldn't the BigInt scalar just need to use a string?
I did't find any info about required serialization to string.
String is only one example of scalar. I think serializing any custom acalar to string is a walkaround and not real scalar implementation. One could define Positive scalar that would represent nonnegative integer and serializing it as string does not make sense.
AFAIK JSON specification of integer is not limited to 32bit int. So BigInt should be serialized to JSON as numer not as string. I think scalar token should be of abstract type that allow defining custom serialization/deserialization.
https://spec.graphql.org/October2021/#sec-Scalars.Custom-Scalars
Ah, right. The bit about serialization to strings was specific to ID.
I think this could be done with a custom token/FieldResult type of std::any, perhaps carrying the scalar typename. Serialization would require plugging in a handler/callback somewhere. In the case of JSON variables, that would probably mean you'd have to parse the scalar type from a JSON fragment as a string.
Does this match what you're suggesting?
Yes it does