Enum values not displayed in models
I think not showing available values in model makes API unclear.
please give more info, and better yet, a sample spec.
"definitions": {
"Menu": {
"properties": {
"menuId": {
"type": "string"
},
"partId": {
"type": "string"
},
"menuName": {
"type": "string"
}
}
},
"Part": {
"properties": {
"partId": {
"type": "string"
},
"partName": {
"type": "string"
},
"moduleId": {
"type": "string"
},
"menus": {
"type": "array",
"items": {
"$ref": "Menu"
}
}
}
},
"Module": {
"required":[
"moduleId"
],
"properties": {
"moduleId": {
"type": "string",
"required" :true,
"description": "Unique identifire for the Module"
},
"moduleName": {
"type": "string"
},
"moduleVersion": {
"type": "string"
},
"moduleState": {
"type": "string",
"default": "",
"enum":[
"STOPED",
"STARTED",
"DISABLED"
]
},
"moduleDescription": {
"type": "string"
},
"moduleUrl": {
"type": "string"
},
"moduleIconUrl": {
"type": "string"
},
"moduleInfoUrl": {
"type": "string"
},
"parts": {
"type": "array",
"items": {
"$ref": "Part"
}
}
}
}
OK so you're talking about model properties having allowable values. thanks
I have changed title because second part was not an issue
I am also encountering this issue. The enum values do not show up in the swagger-ui. In addition, the "description" does not show up either. Here is some example code and screenshot of the result.


is this a swagger 2.0 spec or 1.2?
2.0
Thanks, but just to be clear, you're only talking about allowable values for a model property. The enum is supported in operation parameters now, but yes, what you're describing is a bug.
All right. Hm. Are you saying that what is called an "enum" in the JSON is not an "enum", but rather "allowable values for a model property"? That is OK, I guess, but we are calling them enums in our API, for better or for worse. So what shows up as "enum" in the example JSON is also considered an enum in the context of our API. Not sure of the details here, but it basically consists of a set of fixed values which cannot be deviated from in your operations. Thanks!
No, you're doing the right thing. It's called enum and they are effectively describing what values are allowed for a model property. They should work but are not implemented in the UI. Follow this ticket and it'll get fixed.
All right, great! Thanks... :)
Hi all, I'm getting same issue. It would be great if option for defining available values by using enums would be available. webron said that I should create issue here but there is one already ( http://stackoverflow.com/questions/27603871/how-to-define-enum-in-swagger-io ). Do you think it will be solved anytime soon?
Well, don't blame me. I don't remember all opened issues ;)
It was my bad, I should check issue list here before posting question. Thanks for all you suggestions
No worries, it's not easy finding all available information.
Hi, has this issue been fixed? If yes, which version is it available in? Thanks.
Please note that it's targeted for 2.1.0-M2
Hi all I am getting the same issue. Is this fixed?
@nicolastrres - should be fixed. If not in master then in develop_2.0.
I'm still facing the problem with the current master branch. I've reported it in issue 2184