Data type Boolean renders empty droplist
Using the latest from the develop-2.0 branch (commit b2637fc4bcb61bc92840200aea88055dbaa161f8), I've found these problems with parameters with a data type of boolean and a parameter type of form (Content-Type is application/x-www-form-urlencoded):
- They are rendered with a list with no values in it.
- When I tried setting booleanValues to an array of 0,1, I found that swagger.js wasn't setting a booleanValues property on SwaggerAPI. Once I hacked that, values were rendered in the list. But when I POSTed it, the field wasn't submitted.
Hi, can you please retry this from master? it should be addressed.
Please reopen if you see the issue still.
Hi, I pulled in master and retried it. The boolean fields are still initially rendered with an empty list - there's no default values in it. (I can't work out how to pass in the desired values for boolean fields)
Can you please share the JSON spec that you're displaying?
I tried your latest change and it didn't make a difference.
Here's one of my API declarations that doesn't work (I've renamed a few things):
{
"basePath": "http://internal.api.blah/v2/Products",
"resourcePath": "/swagger/products",
"swaggerVersion": "1.0",
"apiVersion": "2.0",
"consumes": [],
"produces": [],
"apis": [{
"path": "/pricing/ad",
"description": "Get Pricing for an Ad",
"operations": [{
"parameters": [{
"name": "AdvertiserDomicile",
"defaultValue": "1234",
"description": "The Description",
"dataType": "integer",
"required": true,
"allowMultiple": false,
"paramType": "form"
},
{
"name": "LocationId",
"description": "The Location of the Job",
"dataType": "integer",
"required": false,
"allowMultiple": false,
"paramType": "form"
},
{
"name": "ClassificationId",
"description": "The Classification ID",
"dataType": "integer",
"required": false,
"allowMultiple": false,
"paramType": "form"
},
{
"name": "WorkType",
"description": "The Work Type",
"dataType": "integer",
"required": false,
"allowMultiple": false,
"paramType": "form"
},
{
"name": "SalaryMin",
"description": "The minimum Salary",
"dataType": "decimal",
"required": false,
"allowMultiple": false,
"paramType": "form"
},
{
"name": "SalaryMax",
"description": "The maximum Salary",
"dataType": "decimal",
"required": false,
"allowMultiple": false,
"paramType": "form"
},
{
"name": "PayStructure",
"description": "Pay Strucuture enumeration",
"dataType": "integer",
"required": false,
"allowMultiple": false,
"paramType": "form"
},
{
"name": "IsStandout",
"defaultValue": "false",
"description": "True if the job is a Standout Ad",
"dataType": "boolean",
"required": false,
"allowMultiple": false,
"paramType": "form"
},
{
"name": "IsPremium",
"defaultValue": "false",
"description": "True if the job is Premium Listing",
"dataType": "boolean",
"required": false,
"allowMultiple": false,
"paramType": "form"
},
{
"name": "HasScreen",
"defaultValue": "false",
"description": "True if the job has a screen",
"dataType": "boolean",
"required": false,
"allowMultiple": false,
"paramType": "form"
},
{
"name": "HasCustomTemplate",
"defaultValue": "false",
"description": "True if the job has a template",
"dataType": "boolean",
"required": false,
"allowMultiple": false,
"paramType": "form"
}],
"responseMessages": [],
"method": "POST",
"summary": "Returns a pricing result",
"responseClass": "PricingResult",
"nickname": "ProductPricing"
}]
}]
}
Hi, I loaded your file and see the following. Looks correct to me?

if default is "false" in the @ApiParam annotation for my Boolean value, why does it always show "true" on the swagger UI?
what type of parameter is it?
My fault... "False" does not evaluate to "false" - I assumed that it used the same conventions for boolean as in java.. thank you. now it shows "false (default)"
thank you.
I'm on master and the following parameter list also causes the default value for "rememberMe" to be true (on Model Schema), even though I've explicitly set false as you can see below:
... other stuff ignored
"parameters": [
{
"name": "loginData",
"in": "body",
"schema": {
"type": "object",
"properties": {
"username": {
"type": "string",
"example": "admin"
},
"password": {
"type": "password",
"example": "admin"
},
"rememberMe": {
"type": "boolean",
"example": false
}
},
Commenting on an issue that was closed two years ago doesn't help, @queirozfcom. It's definitely not related. Please open a new one. Also, you didn't set the default value, you set the example.