swagger-api / swagger-api/swagger-codegen
[PHP] perhaps Bug in __construct()
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
You must use attributeMap to find the good variable name.
Swagger-codegen version
lastest version
Swagger declaration file content or url
Hi,
https://api-docs.beezup.com/swagger.json
perhaps a bug in constructor variables assignation .
default generated code is by example in camelCase (bug also in snake_case):
$this->container['marketplaceTechnicalCode'] = isset($data['marketplaceTechnicalCode']) ? $data['marketplaceTechnicalCode'] : null;
instead of :
$this->container['marketplaceTechnicalCode'] = isset($data[self::attributeMap()['marketplaceTechnicalCode']]) ? $data[self::attributeMap()['marketplaceTechnicalCode']] : null;
You must use attributeMap to find the good variable name.
Suggest a fix/enhancement
in constructor
$this->container['{{name}}'] = isset($data[self::attributeMap()['{{name}}']]) ? $data[self::attributeMap()['{{name}}']] : null;
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
Locate the PHP generator template or entry point that assembles the generated __construct() assignments, then compare its use of $data with attributeMap() for camelCase and snake_case output. Done means generated PHP clients use the mapped input name in the constructor, including for the provided BeezUP Swagger declaration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100