Netflix / Netflix/dgs-codegen

Code gen doesn't generate client queries when queries are defined in a schema block

Open
#375 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

My GraphQL server generates a GraphQL schema and I'm trying to use that schema to generate the client with the code gen. In the auto-generated schema queries are defined in a schema block:

schema {
   query: MyQuery
}

type MyQuery {
   MyObjects: [MyObject]
}

When I run the code gen the query MyObjects isn't detected and the code for the query isn't generated. When I change type MyQuery to type Query it works fine but I can't change the definition on the server side and I don't want to make any changes in the auto-generated schema.
Do I have to configure the code gen to detect queries defined in a schema block or is this feature unsupported at the moment?

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

Start by reproducing the issue with the schema block and named root type shown in the report, then trace how code generation identifies query types. Done means the generated client includes code for the MyObjects query without changing the schema; no specific files or tests are named in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, kotlin
Domain
api, tooling
Issue type
Bug
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.