Skip to content

Commit

Permalink
[kotlin-client] Add @JsonEnumDefaultValue annotation to enum class (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-tunc authored Aug 18, 2024
1 parent 0a5c997 commit fd62e38
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
{{/moshi}}
{{#jackson}}
{{#enumUnknownDefaultCase}}
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue
{{/enumUnknownDefaultCase}}
import com.fasterxml.jackson.annotation.JsonProperty
{{/jackson}}
{{#kotlinx_serialization}}
Expand Down Expand Up @@ -46,7 +49,7 @@ import kotlinx.serialization.*
@SerializedName(value = {{#lambda.doublequote}}{{{value}}}{{/lambda.doublequote}})
{{/gson}}
{{#jackson}}
@JsonProperty(value = {{#lambda.doublequote}}{{{value}}}{{/lambda.doublequote}})
@JsonProperty(value = {{#lambda.doublequote}}{{{value}}}{{/lambda.doublequote}}){{#enumUnknownDefaultCase}}{{#-last}} @JsonEnumDefaultValue{{/-last}}{{/enumUnknownDefaultCase}}
{{/jackson}}
{{#kotlinx_serialization}}
@SerialName(value = {{#lambda.doublequote}}{{{value}}}{{/lambda.doublequote}})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.openapitools.client.models


import com.fasterxml.jackson.annotation.JsonEnumDefaultValue
import com.fasterxml.jackson.annotation.JsonProperty

/**
Expand All @@ -35,7 +36,7 @@ enum class StringEnumRef(val value: kotlin.String) {
@JsonProperty(value = "unclassified")
unclassified("unclassified"),

@JsonProperty(value = "unknown_default_open_api")
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue
unknown_default_open_api("unknown_default_open_api");

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.openapitools.client.models


import com.fasterxml.jackson.annotation.JsonEnumDefaultValue
import com.fasterxml.jackson.annotation.JsonProperty

/**
Expand All @@ -35,7 +36,7 @@ enum class StringEnumRef(val value: kotlin.String) {
@JsonProperty(value = "unclassified")
unclassified("unclassified"),

@JsonProperty(value = "unknown_default_open_api")
@JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue
unknown_default_open_api("unknown_default_open_api");

/**
Expand Down

0 comments on commit fd62e38

Please sign in to comment.