'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.
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.
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 |