0

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?

user1318369
  • 715
  • 5
  • 15
  • 34
  • 1
    That's not a valid enum definition. See [How to define enum mapping in OpenAPI?](https://stackoverflow.com/q/66465888/113116) – Helen Aug 04 '22 at 07:10

0 Answers0