title: How to Define Enum as Query Params in OpenAPI Spec
body: <p>I want to define an enum value in the query string parameter of a function in an OpenAPI specification.</p>
  
  <p>Here is an example of how I specify the parameter in my OpenAPI specification (yaml):</p>
  
  <pre class="lang-yaml prettyprint-override"><code>openapi: 3.0.0
  info:
    description: Vends sodas
    version: 1.0.0
    title: VendingMachineService
  paths:
    /soda/{bill}:
      get:
        summary: Provides a soda for a provided amount of money
        description: Provides a soda for a provided amount of money
        operationId: getSoda
        parameters:
        - name: bill
          in: path
          description: Money (e.g. one, two, five)
          required: true
          schema:
            $ref: "#/components/schemas/Bill"
        responses:
          "200":
            description: Success
            content:
              application/json:
                schema:
                  $ref: "#/components/schemas/Result"
          "404":
            description: Templates for Source not found
  servers:
  - url: http://localhost:8080/
  components:
    schemas:
      Bill:
        type: string
        enum:
        - one
        - two
        - five
      Result:
        type: string
  </code></pre>
  
  <p>The key part of the OpenAPI spec is that I define the enum in a schema object at the bottom, type string, and refer to it in the parameters section of the function, also defining it as part of the path /{bill}</p>
  
  <p>I then use openapi-generator to generate the spring server:</p>
  
  <pre><code>openapi-generator generate -i ~/vending-machine.yaml -g spring -o ~/output
  </code></pre>
  
  <p>I then spin up the server (importing the project into Intellij and running in a spring-boot configuration) and go to localhost:8080/ to open the Swagger UI. I try to exercise the api and get the following error:</p>
  
  <blockquote>
    <p>{   "timestamp": "2019-03-29T15:43:14.737Z",   "status": 400,<br>
    "error": "Bad Request",   "message": "Failed to convert value of type
    'java.lang.String' to required type 'org.openapitools.model.Bill';
    nested exception is
    org.springframework.core.convert.ConversionFailedException: Failed to
    convert from type [java.lang.String] to type
    [@javax.validation.constraints.NotNull
    @io.swagger.annotations.ApiParam @javax.validation.Valid
    @org.springframework.web.bind.annotation.RequestParam
    org.openapitools.model.Bill] for value 'null'; nested exception is
    java.lang.IllegalArgumentException: No enum constant
    org.openapitools.model.Bill.null",   "path": "/soda/%7Bbill%7D" }</p>
  </blockquote>
  
  <p>(501 Not Implemented expected)</p>
  
  <p>What is the proper way to define the query params &amp; enum in the OpenAPI spec to use enum values?</p>