Netflix / Netflix/dgs-codegen

Generate Deprecated Annotation For Queries

Open
#673 1 comment 0 reactions 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 am having a hard time developing my graphql schema with deprecated queries, mutations and subscriptions.

I have found the config property "addDeprecatedAnnotation", which transforms input values into correctly annotated deprecated methods. (See graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/java/ClientApiGenerator.kt)

I need the same to work for queries, mutations and subscriptions on class level, e.g.:

schema.graphql:

"Query root" type Query { doSomething(anInput: String): Void @deprecated(reason : "Use doSomethingElse instead.")}

should translate into:

/**

  • @deprecated Use doSomethingElse instead.
    */
    @Deprecated
    public class DoSomethingGraphQLQuery extends GraphQLQuery {...}

I would be grateful for any help here. Thanks in advance!

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 with graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/java/ClientApiGenerator.kt, where addDeprecatedAnnotation already handles input values. Trace how query, mutation, and subscription classes are generated, then verify that schema-level @deprecated reasons produce class-level JavaDoc and @Deprecated annotations for those generated classes.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.