-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding option to create @Generated annotation on generated code #424
Adding option to create @Generated annotation on generated code #424
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR contributions!
graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/CodeGen.kt
Outdated
Show resolved
Hide resolved
...en-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/shared/SharedTypeUtils.kt
Show resolved
Hide resolved
I'll change to the suggested name, and I can see the linter is angry with me. I'll fix both. |
@yonatang, thanks for picking up my issue :) As I see a Could you use some other annotation ( The problem with java-provided annotation(s) is explained here: jacoco/jacoco#831 (comment) |
Thanks @bartebor, I was surprised to discover the |
Following the request in #420 and discussion in Netflix/dgs-framework#1147, this PR provides an option to generate
@Generated
annotation over the generated code (both for Java and Kotlin code generators).The code will detect which
@Generated
annotation should be used (javax.annotation.Generated
for JVM <= 8 orjavax.annotation.processing.Generated
for JVM >= 9) and will add that for every relevant TypeSpec (classes, data classes, objects, interfaces, enums, etc). The annotation will contain the generation timestamp, and the code generator name will becom.netflix.graphql.dgs.codegen.CodeGen
, as the @Generated spec requiresThe Java and Kotlin unit tests will use a schema to generate all relevant types, and will verify they: a) have the
@Generated
annotation; and b) can get compiled properly with the annotation present.