Khan / Khan/genqlient

Correctly handle self-recursive types automatically

Open
#152 2 comments 7 reactions 0 assignees View on GitHub
enhancement good first issue help wanted
Dominant language
Go
Stars
1.3k
Forks
143
Avg merge
4h 50m
Merged PRs (30d)
1

Description

(Split from #149.)

If you have in your schema
```graphql
input T {
f: T # or `f: T!`
}
```
then genqlient by default generates
```go
struct T {
F T
}
```
which does not compile. Of course you can manually add `pointer: true`, but we could just do that automatically because it's the only valid way to represent this. Apparently this comes up a lot with Hasura-generated schemas, so although it seems a bit special-casey it's probably worth handling.

Contributor guide

Open the contributing guide

Research direction

Start at the generator path that turns GraphQL input types into Go structs and inspect how the existing `pointer: true` option is applied. Add coverage for `input T { f: T }` and `f: T!`, then verify the generated Go compiles without manual configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, graphql
Domain
devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.