[KOTLIN] add modelMutable additional properties parser (#11332)

* [kotlin] add modelMutable parser

* [kotlin] fix kotlin vertx samples
This commit is contained in:
Ananta Dwi Prasetya Purna Yuda
2022-01-18 18:39:29 +07:00
committed by GitHub
parent 90972c638a
commit 0cb88ce024
7 changed files with 35 additions and 31 deletions

View File

@@ -416,6 +416,10 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");
}
if (additionalProperties.containsKey(MODEL_MUTABLE)) {
additionalProperties.put(MODEL_MUTABLE, Boolean.parseBoolean(additionalProperties.get(MODEL_MUTABLE).toString()));
}
if (additionalProperties.containsKey(CodegenConstants.ENUM_PROPERTY_NAMING)) {
setEnumPropertyNaming((String) additionalProperties.get(CodegenConstants.ENUM_PROPERTY_NAMING));
}

View File

@@ -24,8 +24,8 @@ import com.fasterxml.jackson.annotation.JsonInclude
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class Category (
var id: kotlin.Long? = null,
var name: kotlin.String? = null
val id: kotlin.Long? = null,
val name: kotlin.String? = null
) {
}

View File

@@ -25,9 +25,9 @@ import com.fasterxml.jackson.annotation.JsonInclude
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class ModelApiResponse (
var code: kotlin.Int? = null,
var type: kotlin.String? = null,
var message: kotlin.String? = null
val code: kotlin.Int? = null,
val type: kotlin.String? = null,
val message: kotlin.String? = null
) {
}

View File

@@ -28,13 +28,13 @@ import com.fasterxml.jackson.annotation.JsonInclude
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class Order (
var id: kotlin.Long? = null,
var petId: kotlin.Long? = null,
var quantity: kotlin.Int? = null,
var shipDate: java.time.OffsetDateTime? = null,
val id: kotlin.Long? = null,
val petId: kotlin.Long? = null,
val quantity: kotlin.Int? = null,
val shipDate: java.time.OffsetDateTime? = null,
/* Order Status */
var status: Order.Status? = null,
var complete: kotlin.Boolean? = false
val status: Order.Status? = null,
val complete: kotlin.Boolean? = false
) {
/**

View File

@@ -30,13 +30,13 @@ import com.fasterxml.jackson.annotation.JsonInclude
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class Pet (
@SerializedName("name") private var _name: kotlin.String?,
@SerializedName("photoUrls") private var _photoUrls: kotlin.Array<kotlin.String>?,
var id: kotlin.Long? = null,
var category: Category? = null,
var tags: kotlin.Array<Tag>? = null,
@SerializedName("name") private val _name: kotlin.String?,
@SerializedName("photoUrls") private val _photoUrls: kotlin.Array<kotlin.String>?,
val id: kotlin.Long? = null,
val category: Category? = null,
val tags: kotlin.Array<Tag>? = null,
/* pet status in the store */
var status: Pet.Status? = null
val status: Pet.Status? = null
) {
/**
@@ -53,9 +53,9 @@ data class Pet (
}
var name get() = _name ?: throw IllegalArgumentException("name is required")
set(value){ _name = value }
var photoUrls get() = _photoUrls ?: throw IllegalArgumentException("photoUrls is required")
set(value){ _photoUrls = value }
val name get() = _name ?: throw IllegalArgumentException("name is required")
val photoUrls get() = _photoUrls ?: throw IllegalArgumentException("photoUrls is required")
}

View File

@@ -24,8 +24,8 @@ import com.fasterxml.jackson.annotation.JsonInclude
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class Tag (
var id: kotlin.Long? = null,
var name: kotlin.String? = null
val id: kotlin.Long? = null,
val name: kotlin.String? = null
) {
}

View File

@@ -30,15 +30,15 @@ import com.fasterxml.jackson.annotation.JsonInclude
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class User (
var id: kotlin.Long? = null,
var username: kotlin.String? = null,
var firstName: kotlin.String? = null,
var lastName: kotlin.String? = null,
var email: kotlin.String? = null,
var password: kotlin.String? = null,
var phone: kotlin.String? = null,
val id: kotlin.Long? = null,
val username: kotlin.String? = null,
val firstName: kotlin.String? = null,
val lastName: kotlin.String? = null,
val email: kotlin.String? = null,
val password: kotlin.String? = null,
val phone: kotlin.String? = null,
/* User Status */
var userStatus: kotlin.Int? = null
val userStatus: kotlin.Int? = null
) {
}