entgql: support GraphQL interfaces for nodes via the InterfaceField#638
Open
giautm wants to merge 4 commits into
Open
entgql: support GraphQL interfaces for nodes via the InterfaceField#638giautm wants to merge 4 commits into
giautm wants to merge 4 commits into
Conversation
giautm
force-pushed
the
g/entgql-interfaces
branch
3 times, most recently
from
July 18, 2026 10:18
c6f0d9e to
e48c469
Compare
giautm
force-pushed
the
g/entgql-interfaces
branch
4 times, most recently
from
July 21, 2026 07:30
056f53d to
9577833
Compare
giautm
marked this pull request as ready for review
July 21, 2026 12:39
giautm
force-pushed
the
g/entgql-interfaces
branch
from
July 21, 2026 12:42
9577833 to
27dc461
Compare
…ew template When a node's GraphQL type name differs from the ent type name via entgql.Type() (e.g. Workspace exposed as Organization), the discriminator column in the view stores the GraphQL type name. Using $impl.Name (the ent type name) for byKind lookups and nodes map keys would fail to match. Add nodeGQLType template function and use it in place of $impl.Name for both byKind lookups (line 422) and nodes map keys (line 457).
Remove the allEdgesUnique guard that was erroneously rejecting multi-edge groups with non-unique (to-many) edges. schema.go already handles both cases via its switch: all-unique groups produce a single interface value, while non-unique groups produce an interface connection. The old error made the default branch in schema.go unreachable.
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.
…nnotation
Add
entgql.InterfaceFieldto expose edges from different node types under a shared GraphQL interface and generate polymorphic connections over it: edge-scoped connections (paginated in memory) and a global connection backed by a SQL view (DB-level pagination, orderBy and where), resolving each row to its concrete node so... on Todofragments work.