title: How to fallback on a enum if values don't match in OpenAPI generator's Moshi
body: <p>I have an enum class and would like it to fallback to null if values don't match any of them.</p>
  
  <p>I'm using openapi-generator-cli 3.3.0</p>
  
  <p>e.g. 
  1. generated class</p>
  
  <pre><code>object Serializer {
      @JvmStatic
      val moshi: Moshi = Moshi.Builder()
              .add(KotlinJsonAdapterFactory())
              .add(Unit.javaClass, UnitJsonAdapter())
              .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
              .build()
  }
  
  data class GetProfileResponse (
      @Json(name = "gender") val gender: Gender?
  )
  
  enum class Gender(val value: kotlin.String){
      @Json(name = "male") male("male"),
      @Json(name = "female") female("female");
  }
  
  class Api() : ApiClient() {
    fun getProfileResponse() : GetProfileResponse {
          val localVariableBody: kotlin.Any? = null
          val localVariableQuery: MultiValueMap = mapOf()
  
          val contentHeaders: kotlin.collections.Map&lt;kotlin.String,kotlin.String&gt; = mapOf()
          val acceptsHeaders: kotlin.collections.Map&lt;kotlin.String,kotlin.String&gt; = mapOf("Accept" to "application/json")
          val localVariableHeaders: kotlin.collections.MutableMap&lt;kotlin.String,kotlin.String&gt; = mutableMapOf()
          localVariableHeaders.putAll(contentHeaders)
          localVariableHeaders.putAll(acceptsHeaders)
  
          val localVariableConfig = RequestConfig(
              RequestMethod.GET,
              "/profile",
              query = localVariableQuery,
              headers = localVariableHeaders
          )
          val response = request&lt;GetProfileResponse&gt;(
              localVariableConfig,
              localVariableBody
          )  // call okhttp &amp; moshi (e.g. Serializer.moshi.adapter(T::class.java).fromJson(body.source())) in request()
  
          return when (response.responseType) {
              ResponseType.Success -&gt; (response as Success&lt;*&gt;).data as GetProfileResponse
              ResponseType.Informational -&gt; TODO()
              ResponseType.Redirection -&gt; TODO()
              ResponseType.ClientError -&gt; throw ClientException((response as ClientError&lt;*&gt;))
              ResponseType.ServerError -&gt; throw ServerException((response as ServerError&lt;*&gt;))
              else -&gt; throw kotlin.IllegalStateException("Undefined ResponseType.")
          }
    }
  }
  </code></pre>
  
  <ol start="2">
  <li>API response</li>
  </ol>
  
  <pre><code>{
    "gender": "OtherGender"
  }
  </code></pre>
  
  <p>Running this code results in the following exception:
  com.squareup.moshi.JsonDataException: Expected ~~ but was "OtherGender" at path ~~</p>
  
  <p>But I want to gender = null. How can I do it?</p>