Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Roadmap] Server generator #11

Open
joelwurtz opened this issue Feb 10, 2018 · 4 comments
Open

[Roadmap] Server generator #11

joelwurtz opened this issue Feb 10, 2018 · 4 comments

Comments

@joelwurtz
Copy link
Member

Add a server generator which should generate

  • An interface / abstract class extendable for each endpoint
  • A bridge for each endpoint implementing PSR15 handler interface https://www.php-fig.org/psr/psr-15/ which transform request to object / parameters needed for the endpoint, and object returned by the endpoint into a ResponseInterface
  • A router implementing PSR15 middleware which redirect to the correct endpoint bridge
@joelwurtz
Copy link
Member Author

Optionally it may generate an async version using https://github.com/amphp/aerys

@MichaelKubovic
Copy link

Hey, I'd like to contribute to this feature. I could start with the controller interfaces. Although I like the flexibility of separate interface for each endpoint, I would like to be able to optionally group them by resource. Ideally I'd like to have UserControllerInterface, CarControllerInterface, etc. Tags could be used for this purpose, what do you think?

@fbourigault
Copy link

In my company, we started a new project which is OpenAPI first. We first wrote the schema which defines the contract and now, we are building the server. We currently use jane-openapi to build models and normalizer for the server.

Sadly, jane-openapi also generate the client and the endpoints.

Then for server generation, I would like to use some ADR generator with actions which use Symfony HttpFoundation Request/Response and would use Symfony messenger to send messages into the application and implement CQRS pattern.

Someone would probably use PSR7 instead of HttpFoundation and juste generate some XML routes which map paths to hand written controllers.

As a first step in the direction of a server generator, I would like to allow generators to be configured.

This would solve the generate only the models and the normalizers from an openapi file but neither the client nor the endpoints.
This would also allow to generate a Symfony HTTP Client instead of the PSR-7 one.
This would allow server generation or just a routing configuration or some test data from samples.

This configuration could also allow the use of custom generators to allow users to generate anything they have in mind.

What do you think?

@Korbeil
Copy link
Member

Korbeil commented Sep 15, 2019

First of all, glad you take jane to power up your project 🚀

In case server feature comes, there will be a client mode with what we have today, and a server mode which won't generate stuff you don't want but only server-side related stuff 😉

I totally agree with Request/Response based on Symfony HttpFoundation they're both powerfull and fit to what we do need.
About Symfony Messenger I'll prefer that we have adapters that does connect to whatever you want: Messenger indeed, events or event Controller. Idea is to let the user choose what he prefer, for example: I never used Messenger and I would prefer a Controller adapter approach.

About Symfony HTTP Client or PSR-7, I'll prefer PSR-7 approach since HTTP Client does support PSR-7 and I prefer to be compatible with most of possible implementations instead of just one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants