swagger - Display enum property of model definitions -
i trying display enum of model in model description. schema of model defined under definitions , uses enum action property, because 3 types allowed. (see code below)
i using swagger version 2.0. in version 1.2 seems work: http://petstore.swagger.wordnik.com/ can find example under store/order. use enum , displayed behind property in model view. how can achieve same result new version?
thanks help!
"paths": { "/event": { "post": { "tags": [ "event" ], "summary": "add new event.", "description": "test", "operationid": "addevent", "consumes": [ "application/json" ], "produces": [ "application/json" ], "parameters": [ { "in": "body", "name": "data", "description": "", "required": true, "schema": { "$ref": "#/definitions/event" } } ], "responses": { "405": { "description": "invalid input" } } } } } "definitions": { "event": { "id": "eventmodel", "required": [ "action" ], "properties": { "action": { "type": "string", "default": "start", "enum": [ "start", "update", "end" ], "description": "blabla" } } } }
ps: mistake recognized right now, shown model description of arrays misses closing bracket ].
your definition fine, there's known bug in swagger-ui - https://github.com/swagger-api/swagger-ui/issues/672. feel free subscribe issue , follow progress there.
as side note, there's no "id"
property in models in swagger 2.0.
Comments
Post a Comment