-
Notifications
You must be signed in to change notification settings - Fork 102
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
Client code: Generate deprecations #608
Client code: Generate deprecations #608
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.
We'll need to also update the generateJava task config to be able to use this setting.
assertThat(codeGenResult.javaQueryTypes[0].typeSpec.typeSpecs[0].methodSpecs).hasSize(4) | ||
assertThat(codeGenResult.javaQueryTypes[0].typeSpec.typeSpecs[0].methodSpecs[1].name).isEqualTo("nameFilter") | ||
assertThat(codeGenResult.javaQueryTypes[0].typeSpec.typeSpecs[0].methodSpecs[1].toString()).isEqualTo( | ||
""" |
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.
I would recommend checking that the generated class has the annotation rather than checking the entire code block to string match against. Same for the other tests.
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.
I want to assert that annotation and the javadoc look like expected.
Since both make up the upper part of the code, I rewrote with startsWith()
. That way one you still easily see the empty that is expected to separate description and @deprecated
inside the javadoc.
Is this acceptable? Or would you rather me to use methodSpec
's annotations
and javadoc
for all cases?
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.
I guess we can leave it as is in this scenario, makes sense to me.
…cations, if enabled by addDeprecatedAnnotation - sanitizeJavaDoc() is now also supported directly on a plain String
a106840
to
75adbdd
Compare
Sorry about the late reply 😊
I don't understand that. I did not create that setting, but rather implemented its execution a bit further. Or am I overlooking something? Glad for a hint into the right direction 😄 |
Ah right, my bad. Sorry for the confusion. I see that we do indeed have it here: https://github.com/Netflix/dgs-codegen/blob/master/graphql-dgs-codegen-gradle/src/main/kotlin/com/netflix/graphql/dgs/codegen/gradle/GenerateJavaTask.kt#L145 |
Client code generation now generates annotation and JavaDoc for deprecations, if enabled by
addDeprecatedAnnotation
.Example:
Hi there, 👋
This is my first contribution. I find
createQueryClass()
a very long and therefore unclear method. I did not dare to refactor here 😊 If you are fine with that, I would very much like to improve the code.