title: Swagger/OpenAPI annotations V3 - use Enum values in swagger annotations
body: <p>I'm creating the the API description of our application using Swagger/OpenApi V3 annotations, imported from following dependency:</p>
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springdoc&lt;/groupId&gt;
      &lt;artifactId&gt;springdoc-openapi-ui&lt;/artifactId&gt;
      &lt;version&gt;1.1.45&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  <p>One of the annotations is a <code>@Schema</code> annotation that accepts an attribute named <code>allowableValues</code> which allows a an array of strings:</p>
  <pre><code>@Schema(description = &quot;example&quot;, 
          allowableValues = {&quot;exampleV1&quot;, &quot;exampleV2&quot;}, 
          example = &quot;exampleV1&quot;, required = true)
  private String example;
  </code></pre>
  <p>Now I would like to use a custom method constructed on our Enum class that returns the allowable strings array, so it does not needs to be added upon each time we add a type to our Enum. So that we can use it like this:</p>
  <pre><code>public enum ExampleEnum {
      EXAMPLEV1, EXAMPLEV2;
      public static String[] getValues() {...}
  }
  
  @Schema(description = &quot;example&quot;, 
          allowableValues = ExampleEnum.getValues(), 
          example = &quot;exampleV1&quot;, required = true)
  private String example;
  </code></pre>
  <p>Now this doesn't compile because the method is not known when executing the annotation.
  Is there such a solution that allows usage of Enums in the swagger V3 annotation attributes values?</p>
  <p>Had a look in following resources:</p>
  <ul>
  <li><a href="https://swagger.io/docs/specification/data-models/enums/" rel="noreferrer">https://swagger.io/docs/specification/data-models/enums/</a></li>
  </ul>
  <blockquote>
  <p>You can define reusable enums in the global components section and reference them via $ref elsewhere.</p>
  </blockquote>
  <p>Worst case I can indeed have it defined in one constant place and after adding a type to the Enum only have one other place needed to add the type to. But I first want to explore the above mentioned solution if it's possible.</p>
  <ul>
  <li><a href="https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations#schema" rel="noreferrer">https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations#schema</a></li>
  </ul>
  <p>Doesn't say anything about using any classes or dynamic generated values.</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/23936140/enum-in-swagger">Enum in swagger</a></li>
  </ul>
  <p>Is about documenting enums in swagger and not using them in the swagger annotations API.</p>