OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.36k stars 6.46k forks source link

[REQ] (New?) PHP client generator with -l support #7284

Open dkarlovi opened 4 years ago

dkarlovi commented 4 years ago

Is your feature request related to a problem? Please describe.

We should discuss the fact that php is the client which you should be able to ask to build Symfony bindings (bundle) similar to php-symfony (but as a client, obviously). Currently the other PHP generators are all servers (AFAIK?), but you wouldn't know it from the names alone: php-symfony could also mean "PHP client with Symfony bindings".

Describe the solution you'd like

One direction I'm considering is to add support for -l to the generator which would allow you to add a specific library like -l laravel or -l symfony.

Describe alternatives you've considered

Adding a new generator php-client, which would in turn deprecate php down the line. This approach would also allow fixing issues across PHP generators like #2273 from the start.

dkarlovi commented 4 years ago

@ybelenko WDYT?

ybelenko commented 4 years ago

I'm always open to renaming and refactoring, because like to use the latest versions of packages all the time. I don't know whether @wing328 will approve it.

The second questions is... do we have contributors to implement new 5 php client generators :smile:

I tried to upgrade current 5 php generators and it took a lot of time, feels like a real job. Beside I was unemployed from November 2019 and had infinite free time not like other contributors. And you suggest to add another 5 :smile:

Of course we can push few PRs and create alpha versions of them, like deprecated php-silex. It looks like deprecated before it was even finished.

So..... I'm totally vote for it, but I don't know who can implement it.

dkarlovi commented 4 years ago

I'm suggesting adding one new generator (which could optionally implement specific libraries), not five.

The featureset I'm thinking about:

So my idea is to start very small, but keep quality and consistency high by using all the automation tools the modern PHP ecosystem has to offer.

ybelenko commented 4 years ago
  • Handlebars by default, allowing for (hopefully) more easier implementation (I have no Handlebars experience so don't know how powerful it actually is, hope it's a lot better than Mustache)

I never used Handlebars either, but if it can solve nested variables issue I would vote for it.

I'm not sure that users need templates feature at all, because I found recently popular implementation which works with OpenAPI spec file directly. Here is the link cebe/yii2-openapi on Packagist. It's crazy if we will have to deprecate templates completely when all frameworks will be able to parse spec and generate all the code on their own...

  • PDS compatible

Looks interesting, didn't know about that standard. I could implement it in php-slim4 server for sure.

  • in the future, support for adding OAuth client support (adding for example League OAuth2 client as a dependency, integrating it)

By the way, did you find at least one official PHP implementation of OAuth2? I saw only the official pack with interfaces. I consider to develop my own package with OAuth2 implementation covered with tests when I have time.

UPD: Sorry, misread your message, you're talking about client OAuth2 while I think about server implementation.