• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

99designs / gqlgen / 19991301036
0%

Build:
DEFAULT BRANCH: master
Ran 06 Dec 2025 04:41PM UTC
Jobs 1
Files 0
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

06 Dec 2025 04:38PM UTC coverage: 0.0%. Remained the same
19991301036

push

github

web-flow
feat(codegen): allow users to manually extend GraphQL unions (#3945)

In some scenarios, we need caching or prefetching of parts of the GraphQL query
tree. This is useful if we have a very complex tree and common fragments. This
can allow us to cache the marshalers for some fields that can appear more than
once in the schema.

We use it in a real-world scenario for lookahead fetching. A query returns IDs
of an entity, let's say, an User. For those entities, we have an extra layer
to handle visibility filtering, i.e. am I allowed to see said users (are they
blocked, hidden, restricted, etc.).
The query looks like that:
```graphql
query {
  listUsers {
    userResult {
      ... on User {
        fullname
        age
      }
      ... on UserUnavailable {
        error
      }
    }
  }
}
```

A plain GraphQL implementation, would do, in order:
- Resolve listUsers
- Resolve userResult
- Resolve the fields on the user fragment

We implement lookahead, which will do:
- Resolve listUsers
- Resolve userResult **AND** the fields on the user fragment
- Return the user fragment only if userResult is an User

Lookahead makes requests faster, at the expense of more resolver calls (thus
potentially more RPCs, DB calls, or whatever your resolvers do). We implement
it by having a different type, `LookaheadUserResult`, which is a new member of
the `UserResult` union (which can be either `User` or `UserUnavailable` in the
query above). This ensures we satisfy type requirements, however this change by
itself fails without the template changes of this commit.

This commit extends the generated code for unions: if generated union types are
returned, then we proceed with standard resolving. However, if we receive a
variant that satisfies type constraints (otherwise it won't build eh), but that
the codegen doesn't know about, check if it is a `graphql.Marshaler`, and just
return it, for the parent to call `MarshalGQL` on, as we do for all `Marshaler`!

This is the cleanes... (continued)

0 of 0 relevant lines covered (NaN%)

0.0 hits per line

Jobs
ID Job ID Ran Files Coverage
1 19991301036.1 06 Dec 2025 04:41PM UTC 0
0.0
GitHub Action Run
Source Files on build 19991301036
Detailed source file information is not available for this build.
  • Back to Repo
  • 7c03d116 on github
  • Prev Build on master (#19897643317)
  • Next Build on master (#20027221949)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc