javalin / javalin-openapi

Annotation processor for compile-time OpenAPI & JsonSchema, with out-of-the-box support for Javalin 5.x, Swagger & ReDoc
https://github.com/javalin/javalin-openapi/wiki
Apache License 2.0
45 stars 17 forks source link

Integer enum with value description #226

Open sbahloul opened 1 month ago

sbahloul commented 1 month ago

First of all, thank you for the great work.

Quick question: which annotations should be used to specify an integer enum with values description ?

components:
  schemas:
    RequestTypeEnum:
      type: integer
      enum:
        - 1
        - 2
      description: >
        Sort order:
          * `1` - Description of the requestType = 1
          * `2` - Description of the requestType = 2

Thank you, Sebastien

dzikoysk commented 1 month ago

Hey, thanks :)

Unfortunately, it's currently not possible to declare enums as ints. We're only supporting string values that are valid Java/Kotlin identifiers for name-based matching. We'd need to implement something like @IndexedEnum to enforce position based schema :thinking: