[kotlin-spring] Move Jackson annotation from field to getter (#10825)

* Move Jackson annotation from field to getter

In some case, Jackson will duplicate entries when the annotation is on field
See https://github.com/FasterXML/jackson-databind/issues/1609

* Update samples
This commit is contained in:
Julien Herr
2023-01-02 16:32:57 +01:00
committed by GitHub
parent b8b8c5c208
commit 921199bba7
44 changed files with 191 additions and 191 deletions

View File

@@ -19,9 +19,9 @@ import javax.validation.Valid
*/
data class Category(
@field:JsonProperty("id") val id: kotlin.Long? = null,
@get:JsonProperty("id") val id: kotlin.Long? = null,
@field:JsonProperty("name") val name: kotlin.String? = null
@get:JsonProperty("name") val name: kotlin.String? = null
) {
}

View File

@@ -20,11 +20,11 @@ import javax.validation.Valid
*/
data class ModelApiResponse(
@field:JsonProperty("code") val code: kotlin.Int? = null,
@get:JsonProperty("code") val code: kotlin.Int? = null,
@field:JsonProperty("type") val type: kotlin.String? = null,
@get:JsonProperty("type") val type: kotlin.String? = null,
@field:JsonProperty("message") val message: kotlin.String? = null
@get:JsonProperty("message") val message: kotlin.String? = null
) {
}

View File

@@ -24,17 +24,17 @@ import javax.validation.Valid
*/
data class Order(
@field:JsonProperty("id") val id: kotlin.Long? = null,
@get:JsonProperty("id") val id: kotlin.Long? = null,
@field:JsonProperty("petId") val petId: kotlin.Long? = null,
@get:JsonProperty("petId") val petId: kotlin.Long? = null,
@field:JsonProperty("quantity") val quantity: kotlin.Int? = null,
@get:JsonProperty("quantity") val quantity: kotlin.Int? = null,
@field:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null,
@get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null,
@field:JsonProperty("status") val status: Order.Status? = null,
@get:JsonProperty("status") val status: Order.Status? = null,
@field:JsonProperty("complete") val complete: kotlin.Boolean? = false
@get:JsonProperty("complete") val complete: kotlin.Boolean? = false
) {
/**

View File

@@ -26,19 +26,19 @@ import javax.validation.Valid
*/
data class Pet(
@field:JsonProperty("name", required = true) val name: kotlin.String,
@get:JsonProperty("name", required = true) val name: kotlin.String,
@field:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List<kotlin.String>,
@get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List<kotlin.String>,
@field:JsonProperty("id") val id: kotlin.Long? = null,
@get:JsonProperty("id") val id: kotlin.Long? = null,
@field:Valid
@field:JsonProperty("category") val category: Category? = null,
@get:JsonProperty("category") val category: Category? = null,
@field:Valid
@field:JsonProperty("tags") val tags: kotlin.collections.List<Tag>? = null,
@get:JsonProperty("tags") val tags: kotlin.collections.List<Tag>? = null,
@field:JsonProperty("status") val status: Pet.Status? = null
@get:JsonProperty("status") val status: Pet.Status? = null
) {
/**

View File

@@ -19,9 +19,9 @@ import javax.validation.Valid
*/
data class Tag(
@field:JsonProperty("id") val id: kotlin.Long? = null,
@get:JsonProperty("id") val id: kotlin.Long? = null,
@field:JsonProperty("name") val name: kotlin.String? = null
@get:JsonProperty("name") val name: kotlin.String? = null
) {
}

View File

@@ -25,21 +25,21 @@ import javax.validation.Valid
*/
data class User(
@field:JsonProperty("id") val id: kotlin.Long? = null,
@get:JsonProperty("id") val id: kotlin.Long? = null,
@field:JsonProperty("username") val username: kotlin.String? = null,
@get:JsonProperty("username") val username: kotlin.String? = null,
@field:JsonProperty("firstName") val firstName: kotlin.String? = null,
@get:JsonProperty("firstName") val firstName: kotlin.String? = null,
@field:JsonProperty("lastName") val lastName: kotlin.String? = null,
@get:JsonProperty("lastName") val lastName: kotlin.String? = null,
@field:JsonProperty("email") val email: kotlin.String? = null,
@get:JsonProperty("email") val email: kotlin.String? = null,
@field:JsonProperty("password") val password: kotlin.String? = null,
@get:JsonProperty("password") val password: kotlin.String? = null,
@field:JsonProperty("phone") val phone: kotlin.String? = null,
@get:JsonProperty("phone") val phone: kotlin.String? = null,
@field:JsonProperty("userStatus") val userStatus: kotlin.Int? = null
@get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null
) {
}