Description
When a body parameter is of type boolean and is false, then parameter does not get sent to the server.
Swagger-codegen version
2.2.2
Swagger declaration file content or url
Example parameter:
parameters:
- name: approved
in: body
required: true
description: Whether to approve or disapprove the entity.
schema:
type: boolean
If approved is set as true, then the call works perfectly. Otherwise, it fails, since the code (in ApiClient.js in the function callApi) contains the following:
} else if (bodyParam) {
request.send(bodyParam);
}
Of course, bodyParam is false, so it is not sent.
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i ../swagger.yaml -l javascript --additional-properties usePromises=true
Steps to reproduce
Use this Swagger definition:
/approve:
post:
parameters:
- name: approved
in: body
required: true
schema:
type: boolean
and see the generated call. Try to use it with both approved as true and as false.
Related issues
Could not find.
Suggest a Fix
If there is a body parameter defined in the swagger definition, always send it. Except, perhaps, if it is undefined.
Description
When a body parameter is of type
booleanand isfalse, then parameter does not get sent to the server.Swagger-codegen version
2.2.2
Swagger declaration file content or url
Example parameter:
If
approvedis set astrue, then the call works perfectly. Otherwise, it fails, since the code (inApiClient.jsin the functioncallApi) contains the following:Of course,
bodyParamisfalse, so it is not sent.Command line used for generation
Steps to reproduce
Use this Swagger definition:
and see the generated call. Try to use it with both
approvedastrueand asfalse.Related issues
Could not find.
Suggest a Fix
If there is a body parameter defined in the swagger definition, always send it. Except, perhaps, if it is
undefined.