title: Unable to generate correct swagger for list of enums in scala
body: <p>When generating swagger documentation for lists of enums in our scala apps, the swagger definitions generated are only empty objects. When generating swagger documentation for enums everything is as expected, it is only when dealing with lists of enums.</p>
  
  <p>In scala there are multiple ways of creating enums, our codebase uses this way:</p>
  
  <pre class="lang-scala prettyprint-override"><code>sealed trait AnswerEnum { val value: String }
  case object YES extends AnswerEnum { val value = "YES" }
  case object NO extends AnswerEnum { val value = "NO" }
  </code></pre>
  
  <p>If we imagine that we have an API that only has one endpoint where the expected request looks something like this:</p>
  
  <pre class="lang-scala prettyprint-override"><code>case class SomeRequest(answers: Seq[AnswerEnum])
  </code></pre>
  
  <p>And we want to generate some swagger so we annotate it so it looks like this:</p>
  
  <pre class="lang-scala prettyprint-override"><code>@ApiModel(description = "Example Request")
  case class SomeRequest(
      @ApiModelProperty(value = "List of answers", required = true) answers: Seq[AnswerEnum]
  )
  </code></pre>
  
  <p>We are then left with a definition in our swagger which looks like this:</p>
  
  <pre><code>"AnswerEnum": {
      "type": "object"
  }
  </code></pre>
  
  <p>While what we are looking to get is something like this:</p>
  
  <pre><code>"AnswerEnum": {
      "type": "string",
      "description": "",
      "enum": ["YES", "NO"]
  }
  </code></pre>
  
  <p>If we try to annotate the sealed trait above like this:</p>
  
  <pre class="lang-scala prettyprint-override"><code>@ApiModel(description = "Enum for Yes/No answers")
  sealed trait AnswerEnum {
      val value: String
  
      @ApiModelProperty(value = "Yes/No Answers", dataType = "string", allowableValues = "YES, NO")
      def getAnswerEnum: String = value
  }
  </code></pre>
  
  <p>We end up with a swagger definition looking closer to what we want but not how we want it or how it should be:</p>
  
  <pre><code>"AnswerEnum": {
      "type": "object",
      "properties": {
          "AnswerEnum": {
              "type": "string",
              "description": "Yes/No Answers",
              "enum": ["YES", "NO"]
          }
      },
      "description": "Enum for Yes/No answers"
  }
  </code></pre>
  
  <p>This is the closest we have gotten to getting it correct, but it is still very bad and not correct at all.</p>
  
  <p>If we do something like this, we end up at our current solution, which is not a good solution, but it works:</p>
  
  <pre class="lang-scala prettyprint-override"><code>@ApiModel(description = "Example Request")
  case class SomeRequest(
      @ApiModelProperty(value = "List of answers", dataType = "[Ljava.lang.String;", required = true, allowableValues = "YES, NO") answers: Seq[AnswerEnum]
  )
  </code></pre>
  
  <p>The generated swagger for SomeRequest is at least somewhat correct, in that it generates something which says that the answers are a list of strings, but it doesn't say that it is an enum with the allowable values, however it looks like this:</p>
  
  <pre class="lang-scala prettyprint-override"><code>"SomeRequest": {
      "type": "object",
      "required": [
        "answers"
      ],
      "properties": {
        "answers": {
          "type": "array",
          "description": "List of answers",
          "items": {
            "type": "string"
          }
        }
      },
      "description": "Example Request"
    }
  </code></pre>
  
  <p>We are using</p>
  
  <ul>
  <li><a href="https://mvnrepository.com/artifact/com.github.swagger-akka-http/swagger-akka-http_2.12/1.0.0" rel="nofollow noreferrer">https://mvnrepository.com/artifact/com.github.swagger-akka-http/swagger-akka-http_2.12/1.0.0</a></li>
  <li><a href="https://mvnrepository.com/artifact/io.swagger/swagger-jaxrs/1.5.21" rel="nofollow noreferrer">https://mvnrepository.com/artifact/io.swagger/swagger-jaxrs/1.5.21</a></li>
  </ul>
  
  <p>to generate the swagger.</p>