I have the similar problem as this post, however whenever I try to add my type mappings to my openApiGenerate task I'm met with the following error:
build.gradle': 49: Unexpected input: '{' @ line 49, column 16.
openApiGenerate{
^
1 error
My task config is structured thus:
openApiGenerate{
generatorName = "jaxrs-jersey"
inputSpec = "$project.swaggerFile"
outputDir = "$project.buildSrcRoot"
apiPackage = "$project.apiPackage"
invokerPackage = "$project.rootPackage"
modelPackage = "$project.modelPackage"
generateModelTests = false
globalProperties = [
apis: "",
models: "",
modelDocs: "false",
]
configOptions = [
dateLibrary: "java8",
hideGenerationTimestamp: "true",
invokerPackage: "$project.rootPackage",
useJakartaEe: "false",
]
typeMappings.set([string+date-time: "LocalDateTime"])
importMappings.set([LocalDateTime: "java.time.LocalDateTime"])
}
However removing the type
mapping resolves the issue, but is useless as the import mapping requires a type mapping to be able to achieve the desired result.
I have also not found an example beyond my earlier link on how to add these config to the build.gradle file.
I am using version 6.6.0 of the generator.
typeMappings = [
likeconfigOptions = [
not sure ifset
works with the Groovy Gradle synstax. I've used it within a build.gradle.ktstypeMappings.set( mapOf( "integer+int16" to "kotlin.Short" ) )
– Semiconscious