-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enum values not displayed in models #672
Comments
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 |
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 |
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 ). |
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. |
Still have this issue (enums in *.yaml not displaying in UI). Is it going to be fixed soon? |
@SonnyRajagopalan there shouldn't be an issue with the latest master. If you encounter an issue, open a new ticket and provide a full spec that reproduces the problem. |
@webron , My profound apologies. Tooling error on my part (dealing with an obscenely large spec so I have tools that generate metadata that generate more metadata which finally generate yaml code...). It works just fine. Thanks a heap for your quick response! |
Had the same problem, it would appear that an enum without a "type" specified is not displayed in swagger UI. Adding the "type" to the field definition was enough for it to work. |
I think not showing available values in model makes API unclear.
The text was updated successfully, but these errors were encountered: