In a project, using one of enum-type: framework or format-code: true works fine. When trying to use both of these together, generation fails with an exception during formatting.
The exception cause is a StringIndexOutOfBoundsException: Range [0, -1).
Looking into this it appears that the code here:
|
val index = formatted.lastIndexOf("}") |
is assuming a class, but the exception stack trace shows that it is failing on the package-info.java file in the spring directory that was created. This is because the file doesn't contain braces, so the formatting fails.
I see that the generated api, model, support and validation packages do not contain a package-info.java file, which explains why formatting works for those packages. Only the spring package, which appears to only be created when using enum-type: framework has this file which breaks the formatter.
In a project, using one of
enum-type: frameworkorformat-code: trueworks fine. When trying to use both of these together, generation fails with an exception during formatting.The exception cause is a StringIndexOutOfBoundsException: Range [0, -1).
Looking into this it appears that the code here:
openapi-processor-base/openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/writer/java/GoogleFormatter.kt
Line 36 in 4885fa9
is assuming a class, but the exception stack trace shows that it is failing on the
package-info.javafile in the spring directory that was created. This is because the file doesn't contain braces, so the formatting fails.I see that the generated api, model, support and validation packages do not contain a
package-info.javafile, which explains why formatting works for those packages. Only the spring package, which appears to only be created when usingenum-type: frameworkhas this file which breaks the formatter.