mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-17 08:31:23 +00:00
[kotlin-client][kotlin-server] Feature/kotlin data class serial version uid (#4021)
* feat: add companion object to data classes if the implement the interface java.io.Serializable * style: format template file * style: adapt to project's original code style * fix: add missing imports * style: reverted mustache template to original styling * test: generate additional samples for kotlin-springboot-reactive and kotlin-springboot * docs: name full qualified classname of interface java.io.Serializable to prevent confusion with kotlinx.serialization
This commit is contained in:
@@ -23,10 +23,10 @@ data class ApiResponse (
|
||||
val code: kotlin.Int? = null,
|
||||
val type: kotlin.String? = null,
|
||||
val message: kotlin.String? = null
|
||||
)
|
||||
: Serializable
|
||||
|
||||
) : Serializable
|
||||
{
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ import java.io.Serializable
|
||||
data class Category (
|
||||
val id: kotlin.Long? = null,
|
||||
val name: kotlin.String? = null
|
||||
)
|
||||
: Serializable
|
||||
|
||||
) : Serializable
|
||||
{
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,11 +30,12 @@ data class Order (
|
||||
/* Order Status */
|
||||
val status: Order.Status? = null,
|
||||
val complete: kotlin.Boolean? = null
|
||||
)
|
||||
: Serializable
|
||||
|
||||
) : Serializable
|
||||
{
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
* Values: placed,approved,delivered
|
||||
@@ -48,6 +49,5 @@ data class Order (
|
||||
delivered("delivered");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -32,11 +32,12 @@ data class Pet (
|
||||
val tags: kotlin.Array<Tag>? = null,
|
||||
/* pet status in the store */
|
||||
val status: Pet.Status? = null
|
||||
)
|
||||
: Serializable
|
||||
|
||||
) : Serializable
|
||||
{
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
* Values: available,pending,sold
|
||||
@@ -50,6 +51,5 @@ data class Pet (
|
||||
sold("sold");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ import java.io.Serializable
|
||||
data class Tag (
|
||||
val id: kotlin.Long? = null,
|
||||
val name: kotlin.String? = null
|
||||
)
|
||||
: Serializable
|
||||
|
||||
) : Serializable
|
||||
{
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,10 @@ data class User (
|
||||
val phone: kotlin.String? = null,
|
||||
/* User Status */
|
||||
val userStatus: kotlin.Int? = null
|
||||
)
|
||||
: Serializable
|
||||
|
||||
) : Serializable
|
||||
{
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 123
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user