Codegen for graphql-request with custom scalars #7249
Replies: 2 comments
-
I have exactly the same questions, by looking at the code it seems there's no way to have custom scalars serializers used in building the request. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am having problems trying to use a custom scalar with
typescript-graphql-request
.I implemented the custom scalar using official code as a reference and I used
typescript-resolvers
, adding the custom scalar in the config in the following way:However, it looks like that the resolver of
Money
is not used to create a GraphQL query (I expected the functionserialize
to be called) -- it is consistent with the call toclient.rawRequest
which, if I am not wrong, doesn't have a way to pass resolvers around. The generated part is something like the following:Am I missing something obvious? Is it just a matter of better documenting a combination of features (codegen+scalars+graphql-request)? Or there is a real issue that should be opened?
Note that my workaround is something I would really like to avoid:
money.serialize() as unknown as Money
. As you can imagine, this makes all the static typing & codegen pretty useless for that specific context...Beta Was this translation helpful? Give feedback.
All reactions