swagger-api / swagger-api/swagger-codegen
[PHP] Deserializing array of objects may not work
Open
Nobody has claimed this yet.
Language: php
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When data structure defines array of object, deserializing doesn't work as the nested data may be an array instead of stdclass.
Swagger-codegen version
2.3
Swagger declaration file content or url
/path:
post:
parameters:
- in: body
required: true
name: objectName
schema:
type: object
properties:
arrayInObject:
type: array
minItems: 1
items:
$ref: '#/definitions/SomeObject'
Suggest a fix/enhancement
Cast data to stdclass, if data is array, when deserializing data
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 issue from the provided Swagger declaration, focusing on PHP deserialization of the arrayInObject property and its SomeObject items. Trace the generated deserialization entry point to see where nested arrays are handled; done means arrays of objects deserialize correctly as the expected object instances.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100