Skip to content

Commit

Permalink
Merge branch 'micronaut-projects:master' into openapi-generator-new-p…
Browse files Browse the repository at this point in the history
…arams
  • Loading branch information
altro3 committed Nov 24, 2023
2 parents c2f1b21 + 52ec2ba commit 6c9e0d3
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.micronaut.gradle.openapi


import org.gradle.testkit.runner.TaskOutcome

class OpenApiClientWithKotlinSpec extends AbstractOpenApiWithKotlinSpec {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.micronaut.gradle.openapi


import org.gradle.testkit.runner.TaskOutcome

class OpenApiServerWithKotlinSpec extends AbstractOpenApiWithKotlinSpec {
Expand Down Expand Up @@ -55,10 +54,10 @@ class OpenApiServerWithKotlinSpec extends AbstractOpenApiWithKotlinSpec {
result.task(":compileKotlin").outcome == TaskOutcome.SUCCESS
and:
file("build/generated/openapi/generateServerOpenApiApis/src/main/java/io/micronaut/openapi/api/PetApi.java").exists()
file("build/generated/openapi/generateServerOpenApiModels/src/main/java/io/micronaut/openapi/model/Pet.java").exists()
file("build/classes/java/main/io/micronaut/openapi/api/PetApi.class").exists()
file("build/classes/java/main/io/micronaut/openapi/model/Pet.class").exists()
file("build/generated/openapi/generateServerOpenApiApis/src/main/kotlin/io/micronaut/openapi/api/PetApi.kt").exists()
file("build/generated/openapi/generateServerOpenApiModels/src/main/kotlin/io/micronaut/openapi/model/Pet.kt").exists()
file("build/classes/kotlin/main/io/micronaut/openapi/api/PetApi.class").exists()
file("build/classes/kotlin/main/io/micronaut/openapi/model/Pet.class").exists()
}
def "can generate an kotlin OpenAPI server implementation with properties (KSP)"() {
Expand Down Expand Up @@ -111,9 +110,9 @@ class OpenApiServerWithKotlinSpec extends AbstractOpenApiWithKotlinSpec {
result.task(":compileKotlin").outcome == TaskOutcome.SUCCESS
and:
file("build/generated/openapi/generateServerOpenApiApis/src/main/java/io/micronaut/openapi/api/PetApi.java").exists()
file("build/generated/openapi/generateServerOpenApiModels/src/main/java/io/micronaut/openapi/model/Pet.java").exists()
file("build/classes/java/main/io/micronaut/openapi/api/PetApi.class").exists()
file("build/classes/java/main/io/micronaut/openapi/model/Pet.class").exists()
file("build/generated/openapi/generateServerOpenApiApis/src/main/kotlin/io/micronaut/openapi/api/PetApi.kt").exists()
file("build/generated/openapi/generateServerOpenApiModels/src/main/kotlin/io/micronaut/openapi/model/Pet.kt").exists()
file("build/classes/kotlin/main/io/micronaut/openapi/api/PetApi.class").exists()
file("build/classes/kotlin/main/io/micronaut/openapi/model/Pet.class").exists()
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ graalvmPlugin = "0.9.28"
micronaut-platform = "4.2.0" # This is the platform version, used in our tests
micronaut-aot = "2.1.1"
micronaut-testresources = "2.2.0"
micronaut-openapi = "6.1.0"
micronaut-openapi = "6.2.1"
log4j2 = { require = "2.17.1", reject = ["]0, 2.17["] }
jetbrains-annotations = "24.0.1"
tomlj = "1.1.0"
Expand Down
48 changes: 48 additions & 0 deletions src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ The https://plugins.gradle.org/plugin/io.micronaut.library[Micronaut library plu
* Applies the https://search.maven.org/artifact/io.micronaut.platform/micronaut-platform[Micronaut Bill of Materials (BOM)]
* Applies the `java-library` plugin
* Configures annotation processing for the current language (Groovy, Java or Kotlin)
* <<#sec:automatic-annotation-processors, Adds annotation processors automatically>> for Micronaut modules

The `micronaut` DSL can be used to configure how this behaves.

Expand Down Expand Up @@ -1932,6 +1933,52 @@ micronaut {
In addition, it exposes a `openApiGenerator` configuration which can be used to declare additional dependencies to put on the generator classpath.
This can be useful in case you want to implement your own generators, in which case you will also have to implement custom tasks which extend the link:api/io/micronaut/gradle/openapi/tasks/AbstractOpenApiGenerator.html[AbstractOpenApiGenerator task type].

[[additional-notes]]
== Additional Notes

[[sec:automatic-annotation-processors]]
=== Automatic annotationProcessor dependencies

When the plugin detects you have a dependency with a group id corresponding to a known annotation processor for it, it adds the annotation processor automatically. The following annotation processors are currently supported by this feature.

* `io.micronaut.data:micronaut-data-processor`
* `io.micronaut.jaxrs:micronaut-jaxrs-processor`
* `io.micronaut.micrometer:micronaut-micrometer-annotation`
* `io.micronaut.microstream:micronaut-microstream-annotations`
* `io.micronaut.openapi:micronaut-openapi`
* `io.micronaut.security:micronaut-security-annotations`
* `io.micronaut.serde:micronaut-serde-processor`
* `io.micronaut.spring:micronaut-spring-annotation`
* `io.micronaut.tracing:micronaut-tracing-annotation`
* `io.micronaut.validation:micronaut-validation-processor`

[[sec:suppress-automatic-dependencies]]
=== Suppressing automatic dependencies

In some circumstances, automatic dependencies – e.g. annotation processors listed above – can get in the way. This should be rare, but it is possible to suppress them, as follows. It has no default and using suppression shifts responsibility of adding the dependencies to the user.

.Suppressing automatic dependencies
[source, groovy, subs="verbatim,attributes", role="multi-language-sample"]
----
micronaut {
// The Micronaut plugins can automatically add dependencies to your project. If, for some reason,
// a dependency shouldn't be automatically added, you can add its coordinates to this set.
// The format is "group:name". It must not include the version.
ignoredAutomaticDependencies.add("io.micronaut.data:micronaut-data-processor")
}
----

[source, kotlin, subs="verbatim,attributes", role="multi-language-sample"]
----
micronaut {
// The Micronaut plugins can automatically add dependencies to your project. If, for some reason,
// a dependency shouldn't be automatically added, you can add its coordinates to this set.
// The format is "group:name". It must not include the version.
ignoredAutomaticDependencies.add("io.micronaut.data:micronaut-data-processor")
}
----


== Upgrade notes

=== Upgrading from 2.x
Expand Down Expand Up @@ -1971,3 +2018,4 @@ In addition, the official GraalVM plugin makes use of Gradle toolchains support,
then we recommend tweaking toolchain detection as described in <<#toolchain-behavior, this section of the documentation>>.

In any case, make sure to follow the <<#native-image,configuration instructions>>.

0 comments on commit 6c9e0d3

Please sign in to comment.