FINERACT-1724: Fixed fineract-client generation to handle non-required request bodies in APIs

This commit is contained in:
Arnold Galovics
2022-11-30 08:58:41 +01:00
committed by Arnold Gálovics
parent 47108e0ac9
commit 0c63bf2f27
3 changed files with 169 additions and 99 deletions
+10 -5
View File
@@ -110,15 +110,20 @@ task buildAsciidoc(type: org.openapitools.generator.gradle.plugin.tasks.Generate
dependsOn(':fineract-provider:resolve')
}
task cleanupJodaImports() {
// This is a temporary step to get rid of joda imports in the generated code
// At this point it's unknown why it's even generated, probably it's a bug in the generator
task cleanupGeneratedJavaFiles() {
doLast {
copy {
from "$buildDir/generated/temp-java".toString()
into "$buildDir/generated/java".toString()
filter { line ->
line.replaceAll("import org\\.joda\\.time\\.\\*;", "")
line
// This is a temporary step to get rid of joda imports in the generated code
// At this point it's unknown why it's even generated, probably it's a bug in the generator
.replaceAll("import org\\.joda\\.time\\.\\*;", "")
// The 3 lines below handles the cases when a request body is not required
.replaceAll(", \\)", ")")
.replaceAll(", , @HeaderMap", ", @HeaderMap")
.replaceAll("\\(, ", "(")
}
}
}
@@ -127,7 +132,7 @@ task cleanupJodaImports() {
}
// TODO: @vidakovic we could provide even more client libs in different languages (Go, Ruby, Swift etc.)
compileJava.dependsOn(buildJavaSdk, buildTypescriptAngularSdk, buildAsciidoc, cleanupJodaImports, licenseFormatMain, spotlessMiscApply)
compileJava.dependsOn(buildJavaSdk, buildTypescriptAngularSdk, buildAsciidoc, cleanupGeneratedJavaFiles, licenseFormatMain, spotlessMiscApply)
java {
// keep this at Java 8, not 17; see https://issues.apache.org/jira/browse/FINERACT-1214