Khan / Khan/genqlient

Support gqlgen marshalling

Open
#147 5 comments 1 reaction 0 assignees View on GitHub
enhancement help wanted
Dominant language
Go
Stars
1.3k
Forks
143
Avg merge
4h 50m
Merged PRs (30d)
1

Description

**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](https://gqlgen.com/reference/scalars/). 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 the `UnmarshalX(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**
- https://gqlgen.com/reference/scalars/
- https://github.com/99designs/gqlgen/blob/master/graphql/time.go

Contributor guide

Open the contributing guide

Research direction

Start by reading the gqlgen scalar documentation and the referenced gqlgen/graphql/time.go implementation, then compare those interfaces with genqlient's custom-scalar marshalling behavior. Done means genqlient can use MarshalGQL, UnmarshalGQL, UnmarshalX, and MarshalX APIs without duplicate adapter functions, with coverage for the supported forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, graphql
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.