swagger-api / swagger-api/swagger-codegen

I suggest to create interfaces for PHP-client

Open
#6,271 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Client: PHP General: Suggestion help wanted
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I need to implement caching for classes. I can use decorators or call cache from each method. But decorators cannot be used with DI because classes don't have an interfaces. What about add interfaces to generation?

Example for java.

Swagger-codegen version

2.2.3

Swagger declaration file content or url

My swagger-magento2-client (generated by swagger).

Command line used for generation

Example of config.json

{
    "composerVendorName": "springimport",
    "composerProjectName": "swagger-magento2-client",
    "variableNamingConvention": "camelCase",
    "invokerPackage": "SpringImport\\Swagger\\Magento2\\Client"
}
java -jar swagger-codegen-cli.jar generate -i http://devdocs.magento.com/swagger/schemas/latest-2.1.schema.json -l php -o /home/swagger-codegen2/tmp/php_api_client -c /home/swagger-codegen2/config.json

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PHP generation path used by the shown swagger-codegen command and config.json, then compare its templates with the Java api.mustache example linked in the issue. Trace how the generated Magento2 PHP client classes are produced. Done means the PHP client generation produces interfaces suitable for dependency injection and caching.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.