Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom parser for custom scalars #119

Closed
zhammer opened this issue Oct 23, 2018 · 9 comments
Closed

Custom parser for custom scalars #119

zhammer opened this issue Oct 23, 2018 · 9 comments

Comments

@zhammer
Copy link

zhammer commented Oct 23, 2018

Is there support for using custom parser for schema-defined scalars? Common use case would be parsing Date scalar fields defined in a schema to date objects.

@olejorgenb
Copy link

Handling of special floating point values is another usecase

@sbousamra
Copy link

any news on this? Is this in the works still?

@aryzing
Copy link

aryzing commented Sep 27, 2022

@zhammer were you able to figure it out?

@dan-turner
Copy link

would also like to know

@cris-santos
Copy link

any workarounds?

@tomfa
Copy link

tomfa commented Dec 17, 2022

Here's our workaround for parsing DateTime type (from graphql-scalars) to Date and back. It works for our use case, but is less than ideal.

https://gist.github.com/tomfa/849adb5b7037b9b23ba59bf0d73c801b

@co-sic
Copy link

co-sic commented Jul 7, 2023

I created a small plugin you can use with graphql-request to transform custom scalars: https://github.com/gastromatic/graphql-transform-scalars
I tried already different scenarios in our project and it works well (also for union and interface types). I will add some tests in the coming days. Feedback welcome : )

@jasonkuhrt
Copy link
Member

This will be solved by #672

@jasonkuhrt
Copy link
Member

Actually this was not solved by the PR. This issue is now being tracked for the TS Client here: #744

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants