Repository navigation
Treat @skip/@include fields as nullable (#424) - #425
Open
raunak2007 wants to merge 1 commit into
Open
raunak2007 wants to merge 1 commit into
raunak2007 wants to merge 1 commit into
Conversation
raunak2007
requested review from
StevenACoffman,
benjaminjkraft,
csilvers and
dnerdy
as code owners
October 6, 2026 18:36
csilvers
reviewed
Oct 6, 2026
csilvers
left a comment
Member
There was a problem hiding this comment.
A good catch! -- the rationale makes sense to me. And the fix is nice and self-contained. But I'll let @benjaminjkraft give the final OK, especially in regards to how we want to handle the fact this is technically a breaking change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #424.
genqlient generated a selected field's Go type purely from its schema nullability, ignoring any
@skip/@includeon the selection. Those directives can make a non-null field absent from the response, so the generated type couldn't represent that absence: a skipped field decoded to the zero value with no error.This treats a field with
@skip/@includeas nullable (as ifid: IDrather thanid: ID!) and lets the existing optional-handling decide the representation, per the discussion on #424:optional: value(default): unchanged, still the zero value.optional: pointer/optional: generic: the field becomes a pointer /Optionand can represent an absent value.Technically a breaking change for non-null fields with
@skip/@includeunderoptional: pointeroroptional: generic. That seems right, and such users are probably rare and may already set@genqlient(pointer: true)by hand.Tests:
SkipInclude.graphqlcovers the default config (output unchanged), and it's added to theOptionalPointercase, whereidnow generates as*stringinstead ofstring.I have: