Comments (10)
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 graphql-ppx
accepting a type Option(Js.Json.t)
. We might have to to use something like https://rescript-lang.org/docs/manual/v8.0.0/api/js/json#number and pass the result as input.
from graphql-ppx.
My expectation was that since we've defined a customFields
module for this DateTime
scalar, it would be handled by the PPX for both responses and inputs; otherwise why does the module require a serialize
function for the custom scalar handling?
https://graphql-ppx.com/docs/custom-fields
from graphql-ppx.
Oh graphql-ppx allows us to provide a decoder! Great. Then I think this is bug.
from graphql-ppx.
Custom fields have not been implemented for input objects indeed! I definitely would welcome a PR if you are up for it.
from graphql-ppx.
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 src/base/result_decoder.re
at the moment.
from graphql-ppx.
When using the GitHub GraphQL API, there used to be a workaround: it was possible to use String
instead of custom scalars (like GitObjectID
) because the types were not enforced. Following a recent update of one of their dependencies, this workaround no longer exists, making the issue more pressing. Check coq/bot#203 for details.
from graphql-ppx.
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).
from graphql-ppx.
It's actually not related to this issue, and should just work.
from graphql-ppx.
I meant custom fields in the context of input objects (like you said above had not been implemented yet).
from graphql-ppx.
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.
from graphql-ppx.
Related Issues (20)
- Installation not working. HOT 7
- Unable to install v1.2.1 HOT 3
- Can't use ppxCustom on 2nd level of graphQL HOT 3
- The tests fail non-deterministically HOT 1
- __typename on unions not working HOT 1
- Repeated fragment in auto-generated query. HOT 11
- inconsistent es6/commonJs in Fragments? HOT 7
- Settings from bsconfig don't seem to be read
- Error while running external preprocessor - is not recognized as an internal or external command, HOT 2
- Type checking for InputObject arguments.
- Support directives on VARIABLE_DEFINITION
- Docker on the Apple Silicon Mac won't copy the ppx files and use Rosetta
- An import from `GraphQL_PPX.bs.js` appears in `.bs.js`
- Idea: add ability to output GraphQL DocumentNode instead of function call + graphql string
- Support for Rescript 10 HOT 1
- More verbose Errors for partial unions than "Not_found"
- Usage with Dune and Melange
- Support for rescript 11 and uncurried mode HOT 3
- Graphql-PPX expects bsconfig.json not rescript.json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-ppx.