swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.09k stars 6.03k forks source link

[PHP] Empty Response for api call that has a response #8723

Open blasto333 opened 6 years ago

blasto333 commented 6 years ago
Description

There is an empty response when calling searchCustomers. I traced the code and the response in json is correct but appears to have an issue deserializing and not having data back as objects/arrays

Swagger-codegen version

3

Swagger declaration file content or url

https://demo.phppointofsale.com/application/controllers/api/

Command line used for generation

php codegen

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i https://demo.phppointofsale.com/application/controllers/api/ -l php -o /Users/cmuench/Desktop/api

Steps to reproduce
$apiInstance = new Swagger\Client\Api\CustomersApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$search = "Chris"; // string | Search customers
$search_field = "first_name"; // string | Search specific field
$offset = 0; // int | Offset to list customers
$limit = 20; // int | Number of customers to get

try {

   //always empty
    $result = $apiInstance->searchCustomers($search, $search_field, $offset, $limit);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CustomersApi->searchCustomers: ', $e->getMessage(), PHP_EOL;
}
Related issues/PRs
Suggest a fix/enhancement
mingoarte commented 4 years ago

I got the same issue. Anybody know how to solve this?

Thank you!!