-
Notifications
You must be signed in to change notification settings - Fork 114
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
Support gqlgen marshalling #147
Comments
Oh interesting idea! You can use |
@benjaminjkraft I have a similar problem. I would like to use this type https://github.com/99designs/gqlgen/blob/master/graphql/upload.go but to be honest I don't know how to convert this for |
To be more specific about the configuration, it looks like gqlgen uses a slightly different API for marshaling, but if you only need to unmarshal (i.e. the type is only used as an output), you can add to your config for example: bindings:
Time:
type: github.com/99designs/gqlgen/graphql.Time
unmarshaler: github.com/99designs/gqlgen/graphql.UnmarshalTime If you want to marshal, you could define your own wrapper function matching genqlient's API, and use that. We could try supporting the gqlgen-style marshalers, perhaps as a different option But for |
@benjaminjkraft thanks a lot I will take a look |
any updates on this? |
Is your feature request related to a problem? Please describe.
Custom scalars require marshal and unmarshal functions to tell genqlient how they work.
I already have marshal and unmarshal functions written for gqlgen. I don't want to have to write them a second time or add a layer of indirection to support both gqlgen and genqlient.
Describe the solution you'd like
I would love for genqlient to respect the interfaces prescribed by gqlgen - specifically looking for
MarshalGQL
/UnmarshalGQL
on custom types and supporting theUnmarshalX(v interface{}) (X, error)
/MarshalX(v X) graphql.Marshaler
APIs.Describe alternatives you've considered
Currently, I need to write functions that satisfy both the gqlgen and genqlient interfaces, both of which call into generic functions. This is particularly annoying when dealing with scalar types built-in to gqlgen.
Additional context
The text was updated successfully, but these errors were encountered: