-
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
non-required Boolean value is always selected #1191
Comments
Also, I think it would be better that the value assigned to the selected options was 1 or 0, not the string 'true' or 'false' |
@FJavierGil - true/false is probably more understandable than 1/0, especially to non-developers, so we'll probably keep it as-is. Thank you for the suggestion though. |
I refer to "value" attribute, not the visible text. |
That's not possible. The specification refers to boolean value as being true/false. |
Ok, Thank you. |
If there's a field that you require to have the value of 1/0, I'd suggest setting it as an integer with an enum limiting to those values. |
fix #1191, forgot to put returns on handlebar helper
Another variation to this defect -
The optBooleanDefaultFalse dropdown shows up with value true. |
That's not really a variation of this bug, it's a different one. |
if you make false a string.."false", it'll have the behavior you expect. But I would like to see it behave the same, given a boolean. |
The fix is in, and will eventually be in a release. default: "false" // this will work now and in the fix
....
default: false // this will work in the fix |
awesome! 👍 |
Is there a timeline or workaround for the optional value bug? I have a boolean that is optional and the default case is neither true or false. |
That is by design, if the boolean is optional then we don't want to force either a true or false. In other words it would not send the parameter in the request. See the top comment that started this issue. However, for clarification here is a comparison of what happens in the develop_2.0 branch (our dev branch) |
What you described as an optional boolean with no default value should not get sent is exactly what I'm looking for, but is not what I'm seeing in swagger-ui master. I also am not see the not required, no default case in the test cases you provided. Am I missing something somewhere? |
Try with swagger-ui/develop_2.0 branch. It should look like the first screenshot. |
looks like this is fixed now. |
🎉 🎊 |
@FJavierGil - going over the README, I just noticed the |
Great! Thank you very much! |
fix swagger-api#1191, forgot to put returns on handlebar helper
When defining a
parameter
of typeboolean
andrequired: false
, the generated select-box in Swagger-UI only provides a "true" or "false" option forcing a value to be selected.The expected behavior was that there would be a 3rd option with a blank value (because this is a non-required field)
YAML file:
Viewer:
The text was updated successfully, but these errors were encountered: