Generate enum with open API 3.0

2.6k Views Asked by At

i have the below section in my yaml file for which i need corresponding enums generated. I intend to use the "somemap" as a response for the API.

somemap:
      type: object
      additionalProperties:
        type: object
        properties:
          sortCode:
            type: string
            example: A, D
            enum:
              - code: A
                name: Ascending
              - code: D
                name: Descending

Sample response from the above API:

{
    "somemap" : {
        "sortCode" : [
            "A": "Ascending",
            "D": "Descending"
        ]
 }

Once the classes are generated, i see this as the response:

ResponseEntity<Map<String, Object>> getCodes();

For some reason, the Enum is not there, instead its an Object which can be anything. Can someone please help?

0

There are 0 best solutions below