Khan / Khan/genqlient

Hide __typename field if not user requested

Open
#61 1 comment 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

If you request some field of interface type, we automatically add `__typename` to your selection, so we can use the right type. But you probably don't need that field in your structs; you can always switch on the Go type! So ideally we should omit it from the generated structs. This isn't hard in principle, it's just some awkward plumbing since the place where we need to add it and the place where we need to ignore it are not very close together.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how interface-type selections cause __typename to be added and where generated structs are assembled. Follow the plumbing between those stages, then verify that __typename is omitted from generated structs unless the user requested it while still supporting interface type selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, graphql
Domain
api, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.