-
Notifications
You must be signed in to change notification settings - Fork 14.9k
KAFKA-14198: Define separate swagger configuration in Gradle build #12616
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
KAFKA-14198: Define separate swagger configuration in Gradle build #12616
Conversation
9091739 to
09f1f0b
Compare
| @@ -2564,7 +2568,9 @@ project(':connect:runtime') { | |||
| implementation libs.mavenArtifact | |||
| implementation libs.swaggerAnnotations | |||
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.
Do we need this to be implementation or can it be swagger too?
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 gave this a try but it wasn't successful. We still need the annotations at compile time since they're used to decorate our REST resource classes, like here:
Lines 108 to 114 in b449b80
| @GET | |
| @Path("/") | |
| @Operation(summary = "List all active connectors") | |
| public Response listConnectors( | |
| final @Context UriInfo uriInfo, | |
| final @Context HttpHeaders headers | |
| ) { |
|
|
||
| task genConnectOpenAPIDocs(type: io.swagger.v3.plugins.gradle.tasks.ResolveTask, dependsOn: setVersionInOpenAPISpec) { | ||
| classpath = sourceSets.main.compileClasspath + sourceSets.main.runtimeClasspath | ||
| classpath = sourceSets.main.runtimeClasspath |
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.
Do we need this assignment at all or can we just inline it?
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.
The plugin requires the classpath field to be set.
I also tried this:
classpath = sourceSets.main.runtimeClasspath + configurations.swagger.asCollection()
buildClasspath = classpath
which led to a lot of these warnings:
Gradle detected a problem with the following location... Reason: Task ':connect:runtime:genConnectOpenAPIDocs' uses this output of task ':connect:runtime:processResources' without declaring an explicit or implicit dependency.
Based on discussion in the PR that introduced OpenAPI docs generation for Connect, it appears that setting classpath to sourceSets.main.runtimeClasspath creates some implicit dependencies for the genConnectOpenAPIDocs task that fix these warnings.
|
Thanks @C0urante. Did you verify that the documentation is still generated correctly and the release tarball still doesn't have swagger and snakyaml in the dependencies? |
|
Thanks @ijuma. Yes, I verified both, and updated the PR description with the steps I took to do so. |
ijuma
left a comment
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.
LGTM, thanks.
|
Thanks Ismael. Kicked off another Jenkins build since the previous one failed with a disk space error; will merge if everything looks alright. |
|
Failures appear unrelated, merging. |
Follow-up from #12609. Non-urgent, just tidies up the build file a bit.
Tested and verified locally by:
./gradlew releaseTarGzand then examining the resulting release artifact withtar tf tar tf core/build/distributions/kafka_2.13-3.4.0-SNAPSHOT.tgzto ensure that it did not contain theswaggerJaxrs2jar or its dependencies./gradlew siteDocsTarand then examining the resulting docs withcat docs/generated/connect_rest.yamlto ensure that all Connect REST endpoints were included.Committer Checklist (excluded from commit message)