-
Notifications
You must be signed in to change notification settings - Fork 15k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2535,6 +2535,10 @@ project(':connect:json') { | |
| } | ||
|
|
||
| project(':connect:runtime') { | ||
| configurations { | ||
| swagger | ||
| } | ||
|
|
||
| archivesBaseName = "connect-runtime" | ||
|
|
||
| dependencies { | ||
|
|
@@ -2564,7 +2568,9 @@ project(':connect:runtime') { | |
| implementation libs.mavenArtifact | ||
| implementation libs.swaggerAnnotations | ||
|
|
||
| compileOnly libs.swaggerJaxrs2 | ||
| // We use this library to generate OpenAPI docs for the REST API, but we don't want or need it at compile | ||
| // or run time. So, we add it to a separate configuration, which we use later on during docs generation | ||
| swagger libs.swaggerJaxrs2 | ||
|
|
||
| testImplementation project(':clients').sourceSets.test.output | ||
| testImplementation project(':core') | ||
|
|
@@ -2653,9 +2659,9 @@ project(':connect:runtime') { | |
| } | ||
|
|
||
| task genConnectOpenAPIDocs(type: io.swagger.v3.plugins.gradle.tasks.ResolveTask, dependsOn: setVersionInOpenAPISpec) { | ||
| classpath = sourceSets.main.compileClasspath + sourceSets.main.runtimeClasspath | ||
| classpath = sourceSets.main.runtimeClasspath | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The plugin requires the I also tried this: which led to a lot of these warnings:
Based on discussion in the PR that introduced OpenAPI docs generation for Connect, it appears that setting |
||
|
|
||
| buildClasspath = classpath | ||
| buildClasspath = classpath + configurations.swagger.asCollection() | ||
| outputFileName = 'connect_rest' | ||
| outputFormat = 'YAML' | ||
| prettyPrint = 'TRUE' | ||
|
|
||
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
implementationor can it beswaggertoo?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:
kafka/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/resources/ConnectorsResource.java
Lines 108 to 114 in b449b80