swagger-api / swagger-api/swagger-codegen
[PHP] Add support for Generation Gap pattern
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Generation Gap pattern is useful for extending codes which generated.
Generation Gap pattern
Generation Gap martinfowler.com
https://martinfowler.com/dslCatalog/generationGap.html
Generation Gap is about keeping the generated and handwritten parts separate by putting them in different classes linked by inheritance.
Sample
class HandwrittenPet extends Pet
{
// just a sample.
// it has room for improvement.
public function canNotBuy()
{
return $this->status === ‘pending’ || $this->status === ‘sold’;
}
}
$api = new PetApi();
// I'd like to add `setReturnType()` to specify the ReturnType.
$api->setReturnType(‘\Path\To\HanwrittenPet’);
$pet = $api->getPetById(1);
var_dump($pet);
// class \Path\To\HanwrittenPet
var_dump($pet->canNotBuy());
// bool
Swagger-codegen version
2.3.0+
--
How you do you feel about it?
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
No files, tests, or entry points are named in the issue. Start by locating the PHP generator/template responsible for the sample PetApi output and define how generated and handwritten classes should be separated; done means the requested return-type behavior is specified and covered for generated PHP clients.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100