swagger-api / swagger-api/swagger-codegen
[PHP] Empty Response for api call that has a response
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the generated PHP client command against the linked API declaration and call CustomersApi::searchCustomers with the supplied parameters. Inspect the response deserialization path and compare it with the reported correct JSON response. Done means searchCustomers returns populated objects or arrays instead of an empty result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100