'enum of objects in swagger UI?

I have an enum of other definitions in my Swagger spec:

"action": {
  "title": "Action",
  "description": "Action to apply to matching requests",
  "type": "object",
  "enum": [ 
    {"delayAction": {"$ref": "#/definitions/delayAction"}}, 
    {"abortAction": {"$ref": "#/definitions/abortAction"}},
    {"traceAction": {"$ref": "#/definitions/traceAction"}}
  ]
}

and delayAction, abortAction, and traceAction are all defined.

But in the Swagger UI the model for action is empty.

enter image description here

How can I modify my Swagger definition so Swagger UI can show the definition of action in the model?



Solution 1:[1]

I think enums can be defined only as object literals. Checkout this example it seems to explain quite well with an example.

https://community.smartbear.com/t5/Swagger-Open-Source-Tools/Enum-of-defined-objects/m-p/198117/highlight/true#M988

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alexander Krum