-
Notifications
You must be signed in to change notification settings - Fork 53
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 Scalar parsing/serializing not working in InputObjects #272
Comments
Hi @illusionalsagacity, I have not used GraphQL much. So please correct me if I am wrong. According to the GraphQL spec the client must serialize the value of the scalar type. So it makes sense of |
My expectation was that since we've defined a |
Oh graphql-ppx allows us to provide a decoder! Great. Then I think this is bug. |
Custom fields have not been implemented for input objects indeed! I definitely would welcome a PR if you are up for it. |
Any idea on where/what would a starting point for this would be? Looking around in |
When using the GitHub GraphQL API, there used to be a workaround: it was possible to use |
Custom scalars should be just the JSON type. So if it's a string natively, you need to convert it to a JSON type (YoJson on native, Js.Json.t on ReScript). |
It's actually not related to this issue, and should just work. |
I meant custom fields in the context of input objects (like you said above had not been implemented yet). |
Custom fields are just an ergonomic way to automatically convert custom scalars (or other custom fields). But you can use custom scalars in input objects, you just have to convert to a Json type. |
Reproduction: illusionalsagacity@9630e02#diff-dccca68100be513fb2d07560888ab2c0785e6033bc6babd303fb6bfe07810f1dR52
tests_bucklescript/__snapshots__/Generate_Apollo_scalarsInput_re.bda5f930.0.snapshot
line 52when using
customFields
, the Scalar types in input objects do not seem to be using those custom parsers and instead show up asoption(Js.Json.t)
Looks like this was just missing from the test cases?
The text was updated successfully, but these errors were encountered: