Bug Report Checklist
Description
When params are of type "boolean", they should be sent as "true" or "false", but the PHP generator sends them as "1" or "". But it correctly documents the parameters as @param bool. So if you send boolean parameters, it ends up doing something like (string) true, which evaluates to 1.
openapi-generator version
4.0.0-SNAPSHOT
OpenAPI declaration file content or url
https://gist.github.com/jacobweber/e83874fbf1c0ee6ede79100a7507e11f
Command line used for generation
java -jar openapi-generator.jar generate -i <url> -g php -o /path/to/output
Steps to reproduce
- Build the above spec.
- Run
composer install from the output dir.
- Run the "Getting Started" example code in README.md:
$admin = True; // bool | Include admin users?
try {
$result = $apiInstance->usersGet($admin);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->usersGet: ', $e->getMessage(), PHP_EOL;
}
- It calls
GET http://localhost/api/users?admin=1 instead of GET http://localhost/api/users?admin=true.
Related issues/PRs
N/A
Suggest a fix
Detect booleans and convert to "true" or "false".
Bug Report Checklist
Description
When params are of type "boolean", they should be sent as "true" or "false", but the PHP generator sends them as "1" or "". But it correctly documents the parameters as
@param bool. So if you send boolean parameters, it ends up doing something like(string) true, which evaluates to1.openapi-generator version
4.0.0-SNAPSHOT
OpenAPI declaration file content or url
https://gist.github.com/jacobweber/e83874fbf1c0ee6ede79100a7507e11f
Command line used for generation
java -jar openapi-generator.jar generate -i <url> -g php -o /path/to/outputSteps to reproduce
composer installfrom the output dir.GET http://localhost/api/users?admin=1instead ofGET http://localhost/api/users?admin=true.Related issues/PRs
N/A
Suggest a fix
Detect booleans and convert to "true" or "false".