[PHP] "getFieldDeserializers() should return array..." with MERAKI.COM api
- Dominant language
- C#
- Stars
- 3.8k
- Forks
- 333
- Avg merge
- 16h 29m
- Merged PRs (30d)
- 116
Description
Found as part of #7774:
Using the source code from 2026-06-17 and this command:
```
.\it\generate-code.ps1 -descriptionUrl https://raw.githubusercontent.com/meraki/openapi/refs/heads/master/openapi/spec3.json -language php -dev
.\it\exec-cmd.ps1 -descriptionUrl https://raw.githubusercontent.com/meraki/openapi/refs/heads/master/openapi/spec3.json -language php
```
The generated client does not compile:
```
------ ---------------------------------------------------------------------------------------------------------------
Line Client\Networks\Item\Clients\Item\SplashAuthorizationStatus\SplashAuthorizationStatusGetResponse_ssids.php
------ ---------------------------------------------------------------------------------------------------------------
55 Method
Integration\Test\Client\Networks\Item\Clients\Item\SplashAuthorizationStatus\SplashAuthorizationStatusGetResp
onse_ssids::getFieldDeserializers() should return array but returns array{Closure(Microsoft\Kiota\Abstractions\Serialization\ParseNode): voi
d}.
🪪 return.type
------ ---------------------------------------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------------------------------------
Line Client\Networks\Item\Clients\Item\SplashAuthorizationStatus\SplashAuthorizationStatusPutResponse_ssids.php
------ ---------------------------------------------------------------------------------------------------------------
55 Method
Integration\Test\Client\Networks\Item\Clients\Item\SplashAuthorizationStatus\SplashAuthorizationStatusPutResp
onse_ssids::getFieldDeserializers() should return array but returns array{Closure(Microsoft\Kiota\Abstractions\Serialization\ParseNode): voi
d}.
🪪 return.type
------ ---------------------------------------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------------------------------------
Line Client\Organizations\Item\ApiRequests\Overview\OverviewGetResponse_responseCodeCounts.php
------ ---------------------------------------------------------------------------------------------------------------
290 Method
Integration\Test\Client\Organizations\Item\ApiRequests\Overview\OverviewGetResponse_responseCodeCounts::getFi
eldDeserializers() should return array but returns non-empty-array<200|201|202|203|204|205|206|207|208|226|300|301|302|303|304|305|306|307|3
08|400|401|402|403|404|405|406|407|408|409|410|411|412|413|414|415|416|417|421|422|423|424|425|426|428|429|43
1|451|500, callable(): mixed>.
🪪 return.type
```
The relevant snippet from "Client\Networks\Item\Clients\Item\SplashAuthorizationStatus\SplashAuthorizationStatusGetResponse_ssids.php" is:
```php
/**
* The deserialization information for the current model
* @return array
*/
public function getFieldDeserializers(): array {
$o = $this;
return [
'0' => fn(ParseNode $n) => $o->setZero($n->getObjectValue([SplashAuthorizationStatusGetResponse_ssids_Zero::class, 'createFromDiscriminatorValue'])),
];
}
```
Snippet of the API description:
```json
"/networks/{networkId}/clients/{clientId}/splashAuthorizationStatus": {
"get": {
"description": "Return the splash authorization for a client, for each SSID they've associated with through splash. Only enabled SSIDs with Click-through splash enabled will be included. Clients can be identified by a client key or either the MAC or IP depending on whether the network uses Track-by-IP.",
"operationId": "getNetworkClientSplashAuthorizationStatus",
"parameters": [
...
],
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"ssids": {
"type": "object",
"properties": {
"0": {
"type": "object",
"properties": {
"isAuthorized": {
"type": "boolean",
"description": "Whether the client is currently authorized on this SSID"
},
"authorizedAt": {
"type": "string",
"description": "When the client was authorized on this SSID in ISO 8601 format. This field will be null if the client is not currently authorized.",
"x-nullable": true
},
"expiresAt": {
"type": "string",
"description": "When the client's authorization on this SSID expires in ISO 8601 format. This field will be null if the client is not currently authorized or if there is no expiration time for the authorization.",
"x-nullable": true
}
},
"description": "Splash authorization for SSID 0"
}
},
"description": "A map of SSID number to the client's splash authorization status for that SSID. Only SSIDs that the client has connected to in the past will be included."
}
}
},
```
Same for "SplashAuthorizationStatusPutResponse_ssids.php".
The relevant snippet from "Client\Organizations\Item\ApiRequests\Overview\OverviewGetResponse_responseCodeCounts.php" is:
```
/**
* The deserialization information for the current model
* @return array
*/
public function getFieldDeserializers(): array {
$o = $this;
return [
'500' => fn(ParseNode $n) => $o->setFiveZeroZero($n->getIntegerValue()),
'451' => fn(ParseNode $n) => $o->setFourFiveOne($n->getIntegerValue()),
'415' => fn(ParseNode $n) => $o->setFourOneFive($n->getIntegerValue()),
'414' => fn(ParseNode $n) => $o->setFourOneFour($n->getIntegerValue()),
...
'200' => fn(ParseNode $n) => $o->setTwoZeroZero($n->getIntegerValue()),
];
}
```
Contributor guide
Research direction
Run the two commands in the issue using the Meraki OpenAPI description and inspect the generated PHP files named in the static-analysis errors. Trace the PHP generator behavior for object properties with numeric names and response-code keys, then regenerate the client. Done means the affected generated files pass the reported return-type checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100