-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Parameter selection dropdown selects a default value on the UI from allowableValues even if defaultValue is not set but cannot be Executed with that value #3890
Comments
Hi @gdavidmac, sorry you're having issues. I'm a bit confused by your report - here's some clarifying questions:
Regarding your |
@gdavidmac, try the latest version of Swagger UI. @shockey this sounds like one of the enum try-it-out bugs that were fixed in previous updates. |
Hi @shockey Sorry, I didn't realize the Java version was not in common use, I'll try to restate my question using more correct Swagger terminology.
I think @hkosova is correct that this looks very similar to the linked bugs regarding default values for enum parameters, where a default selected value appears for the dropdown box on the UI, but that default selected value does not work. Are those fixes included in a subsequent Swagger-UI version? |
No worries. It is pretty common downstream of us (lots of Java Swagger tooling ships with Swagger-UI) but I only speak Swagger/OpenAPI and JavaScript 😄
Hmm, that's not a valid Swagger version 😕 You might be looking at the version of your tool - do you have a Valid Swagger versions are
Yes, it is. You should try opening your definition at http://petstore.swagger.io/ (or use http://editor.swagger.io if you'd prefer to copy-paste your definition instead of loading via HTTP request), both of those pages are kept up-to-date with the latest version of Swagger-UI (current If you still see the issue there, then we have a bug on our hands. |
@gdavidmac @shockey swagger-core 1.5.13 is not that far behind the latest version and the definition itself looks correct. It's outputting Swagger 2.0 definitions. @gdavidmac please just try with the latest version to see if the issue is resolved. |
Closing due to inactivity. This is simply to keep our issue tracker clean - feel free to comment if there are any further thoughts or concerns, and we'll be happy to reopen this issue. |
Bug
Swagger version:
Maven io.swagger/swagger-jersey2-jaxrs 1.5.13
Swagger-UI version:
3.0.7/g69fd57f-dirty
Chrome Version 55.0.2883.87 m
Widnows 7 Professional
Code that causes the issue
@ApiParam(required = true, allowableValues = "TYPE1, TYPE2, TYPE3, TYPE4", value = "Update what Type of data") @PathParam(value="dataType") final String dataType,
Expected Behavior
A parameter with allowableValue set but no defaultValue should either not show a selected value in the dropdown box until explicitly selected by the user, or should show a default value (first in the list, for example) that is functional and allows the user to click Execute and send the request.
Current Behavior
Currently, dropdowns for parameters with allowableValue set but no defaultValue will show the first allowable value in the field by default. However, that apparent value shown on the web UI is not actually properly selected, and clicking Execute will silently fail to send any request or perform any action, without feedback to the user. To actually send a request, the user must click to open the dropdown and manually select an option. The need to manually select a value is hidden by the presence of an apparently already-selected default option.
Possible Solution
Either:
Context
This is quite misleading to users, since an apparent default value for the parameter is selected but is not functional. The user must manually set a value for the dropdown for it to work, but the display of the field itself suggests that a default value is already selected.
The text was updated successfully, but these errors were encountered: