swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.03k stars 6.03k forks source link

I suggest to create interfaces for PHP-client #6271

Open springimport opened 7 years ago

springimport commented 7 years ago
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
wing328 commented 7 years ago

@springimport thanks for the suggestion

cc @baartosz @dkarlovi @arnested @ackintosh

dkarlovi commented 7 years ago

Definitely agree, having a well defined interface would significantly raise output quality. Can you provide a PR?

ackintosh commented 7 years ago

I totally agree 👍