PHP: JSON Parsing of Array Response #1553
-
I have an openAPI doc containing collection endpoints. These endpoints return unwrapped arrays of a model as a response. # ...
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/FreePass'
# ... Nevertheless the generated PHP Client Code tries to put that list response in one Object of the model. public function get(?Free_passesRequestBuilderGetRequestConfiguration $requestConfiguration = null, ?ResponseHandler $responseHandler = null): Promise
{
$requestInfo = $this->createGetRequestInformation($requestConfiguration);
try {
return $this->requestAdapter->sendAsync($requestInfo, FreePass::class, $responseHandler);
} catch (Exception $ex) {
return new RejectedPromise($ex);
}
} Am I missing or overseeing something here? Is there another way to define these kind of object lists in openapi? Or do I need to implement a responseHandler on my own that parses each item with the NodeParser? I am looking forward to any ideas or opinions :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @Bastianowicz. Really appreciate your trying out PHP generation. Keep the feedback coming :) |
Beta Was this translation helpful? Give feedback.
Hey @Bastianowicz.
This is a bug whose fix should be getting merged soon by #1496.
The fix ensures that
sendCollectionAsync()
is called and that should return a list of objects.Really appreciate your trying out PHP generation. Keep the feedback coming :)