micronaut-openapi icon indicating copy to clipboard operation
micronaut-openapi copied to clipboard

openapi.properties file not taking into account when using kapt from Micronaut 4.4.0

Open agartime opened this issue 8 months ago • 5 comments

Expected Behavior

Properties defined under openapi.properties are not populated when using kapt from Micronaut 4.4.0.

I expect openapi to generate the definition yaml file in the path specified under micronaut.openapi.target.file, and not in the default path under META-INF/.

api.version and openapi.title properties are broken too.

Actual Behaviour

micronaut.openapi.target.file property is ignored when is set under openapi.propertiesfile and "io.micronaut.openapi:micronaut-openapi" dependency is declared with kapt:

kapt("io.micronaut.openapi:micronaut-openapi")

Full stacktrace can be seen here:

error: Error finalizing type visitor [io.micronaut.openapi.visitor.OpenApiApplicationVisitor@407e6e29]: Invalid relative name: META-INF/swagger/${openapi.title}-${api.version}.yml
  java.lang.IllegalArgumentException: Invalid relative name: META-INF/swagger/${openapi.title}-${api.version}.yml
        at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getFileForOutput(JavacFileManager.java:898)

The problem doesn't happen when ksp is used for "io.micronaut.openapi:micronaut-openapi" dependency, or when using micronaut < 4.4.0.

Steps To Reproduce

  1. git clone https://github.com/agartime/issue-openapi-kapt-micronaut-4.5
  2. cd issue-openapi-kapt-micronaut-4.5
  3. ./gradlew clean build

Environment Information

  • Kotlin: 1.9.23
  • Micronaut: 4.5.0 (also 4.4.0)
  • Gradle: 8.8
  • JDK: 17

Example Application

https://github.com/agartime/issue-openapi-kapt-micronaut-4.5

Version

4.5.0

agartime avatar Jun 28 '24 11:06 agartime