Netflix / Netflix/dgs-codegen

Unnecessary warning is generated on `fieldsSet`

Open
#299 0 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

Having a schema like this

enum PokemonType {
   FIRE
   WATER
   ELECTRIC
   GRASS
}

type Query {
   getAllPokemonTypes: [PokemonType!]!
}

The plugin generates a GetAllPokemonTypesGraphQLQuery class containing a warning inside the Builder

public static class Builder {
    private Set<String> fieldsSet = new HashSet<>();
    ....
  }
The value of the field GetAllPokemonTypesGraphQLQuery.Builder.fieldsSet is not used

I believe it happens always when the return value of a query is a [xxx!]!, whether is an enum or type.

It's not very important but it would be nice to remove it, so we can keep the generated code warning-free!

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 issue with the provided GraphQL schema and inspect the generated GetAllPokemonTypesGraphQLQuery.Builder, focusing on the fieldsSet declaration and the generation path for non-null list return values. Done means the generated Builder no longer contains an unused fieldsSet warning for this schema, while preserving query generation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.