mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 02:47:05 +00:00
[kotlin-client][jackson] Add support for unknown default enum value (#17404)
* [kotlin-client][jackson] Enable @JsonEnumDefaultValue * Update samples
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.openapitools.client.infrastructure
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import com.fasterxml.jackson.databind.SerializationFeature
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
@@ -10,5 +11,6 @@ object Serializer {
|
||||
val jacksonObjectMapper: ObjectMapper = jacksonObjectMapper()
|
||||
.findAndRegisterModules()
|
||||
.setSerializationInclusion(JsonInclude.Include.NON_ABSENT)
|
||||
.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, true)
|
||||
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
||||
/**
|
||||
@@ -62,7 +63,7 @@ data class Order (
|
||||
@JsonProperty(value = "placed") placed("placed"),
|
||||
@JsonProperty(value = "approved") approved("approved"),
|
||||
@JsonProperty(value = "delivered") delivered("delivered"),
|
||||
@JsonProperty(value = "unknown_default_open_api") unknownDefaultOpenApi("unknown_default_open_api");
|
||||
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.openapitools.client.models
|
||||
import org.openapitools.client.models.Category
|
||||
import org.openapitools.client.models.Tag
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
||||
/**
|
||||
@@ -65,7 +66,7 @@ data class Pet (
|
||||
@JsonProperty(value = "available") available("available"),
|
||||
@JsonProperty(value = "pending") pending("pending"),
|
||||
@JsonProperty(value = "sold") sold("sold"),
|
||||
@JsonProperty(value = "unknown_default_open_api") unknownDefaultOpenApi("unknown_default_open_api");
|
||||
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user