Netflix / Netflix/dgs-codegen

Query type and QueryProjectionRoot classes are not generated for client code

Open
#589 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
217
Forks
116
PR merge metrics
No merged PRs in 30d

Description

Hello. I'm evaluating dgs-codegen and when generating client code, it seems it doesn't generate any type nor projection classes for the root Query type. If I want to write a client request using multiple top-level fields under the root type, I'd expect to have classes generated for the root Query type, like Query, QueryProjectionRoot, and QueryGraphQLQuery.

Is this intentional? For example with a simple schema as

type Query {
  foo: String
  bar: String
}

I'd expect to also get all the Query classes to be able to query the two fields at the same time. I can write them by hand, but it's not really nice because I'd have to change them each time a new top-level field is added under Query.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with the schema containing Query.foo and Query.bar, then inspect the client-code generation entry point and its generated output. Confirm whether root Query classes are omitted intentionally; done means generating Query, QueryProjectionRoot, and QueryGraphQLQuery classes that can select both top-level fields together.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, kotlin
Domain
api, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.