How can i generate optional values in openapi generator?

37 views Asked by At

I can't generate optional values in openapi generate. It is generating like this:

x: kotlin.String?` but i want to like this : `x: kotlin.String?= null`
and this is my build.gradle file:
`services.forEach { service ->
    val camelCaseServiceName = service.split("-").joinToString("", transform = String::capitalized)
    tasks.create("openApiGenerate${camelCaseServiceName}", GenerateTask::class) {
        id = service
        generatorName = "kotlin"
        library = "jvm-spring-webclient"
        outputDir = "$rootDir/generated/${service}"
        auth = "Authorization:Basic%20${openApiAuth}"
        generateApiDocumentation = false
        generateApiTests = false
        generateModelTests = false
        cleanupOutput = true
        additionalProperties = mapOf(
            "serializationLibrary" to "jackson",
            "enumPropertyNaming" to "PascalCase"
        )
        globalProperties = mapOf(
            "apiDocs" to "false",
            "modelDocs" to "false",
            "apiTests" to "false",
            "modelTests" to "false",
        )
    }`

How can I solve this problem?

Generate this :

x: kotlin.String?

expect this :

x: kotlin.String?= null

0

There are 0 answers