Replies: 1 comment 3 replies
-
I think that makes sense to add. Any PR contributions appreciated!
…On Tue, Jul 12, 2022 at 11:33 AM Yonatan Graber ***@***.***> wrote:
Hi,
Right now, if you would naively use DGS generated code, the code would be
scanned by code coverage tools, and most likely to be reported as missing
coverage, as it makes little sense to fully test generated code (as
reported at Netflix/dgs-codegen#420
<Netflix/dgs-codegen#420>).
Code generation frameworks usually allow to add a @generated annotation
on such classes (i.e. Lombok's
<https://projectlombok.org/features/configuration>
addLombokGeneratedAnnotation, or addGeneratedAnnotation in
graphql-java-codegen
<https://github.com/kobylynskyi/graphql-java-codegen/blob/master/docs/codegen-options.md>.
I believe most code coverage tools could be configure to skip @generated
annotated classes.
I wish to add a feature that will allow to add @generated annotation on
the generated sources. It could be a flag with a false default value,
which would guarantee backwards compatibility. I believe the approach
implemented in graphql-java-codegen here
<https://github.com/kobylynskyi/graphql-java-codegen/blob/master/src/main/java/com/kobylynskyi/graphql/codegen/model/GeneratedInformation.java>
would work well in this project as well - it would detect that which (and
if) @generated <https://github.com/generated> annotation is available on
the classpath, to eliminate potential
javax.annotation.processing.Generated vs javax.annotation.Generated
issues.
Please let me know what do you think.
—
Reply to this email directly, view it on GitHub
<#1147>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJ5JPXNX5ASECO6WXMDSRRTVTW26RANCNFSM53L65NJA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
Right now, if you would naively use DGS generated code, the code would be scanned by code coverage tools, and most likely to be reported as missing coverage, as it makes little sense to fully test generated code (as reported at Netflix/dgs-codegen#420).
Code generation frameworks usually allow to add a
@Generated
annotation on such classes (i.e. Lombok'saddLombokGeneratedAnnotation
, oraddGeneratedAnnotation
in graphql-java-codegen). I believe most code coverage tools could be configure to skip@Generated
annotated classes.I wish to add a feature that will allow to add
@Generated
annotation on the generated sources. It could be a flag with afalse
default value, which would guarantee backwards compatibility. I believe the approach implemented in graphql-java-codegen here would work well in this project as well - it would detect that which (and if) @generated annotation is available on the classpath, to eliminate potentialjavax.annotation.processing.Generated
vsjavax.annotation.Generated
issues.Please let me know what do you think.
Beta Was this translation helpful? Give feedback.
All reactions