-
Notifications
You must be signed in to change notification settings - Fork 124
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
Seperate out service impl and Play router #364
Comments
The trade-off here is between having the router separate from the service class on the one hand, and requiring the user to add extra binding logic on the other hand. I agree having the router separate would be great - the question is whether it's worth confronting the user with the extra complexity of manually binding so early... especially since when the binding is missing the error message might not be so easy to understand for a new user. Is there something we can do to have both? |
Looks like this issue is interested in reverting part of #291, so /cc @johanandren too. I think this thread https://typesafe.slack.com/archives/C26GD21T3/p1534317332000100 and the threads/issues/PRs it links to are possibly also relevant? Looks like a hot topic, I'll find something easier.. 🙂 |
I really think this should only be done if we can think of a scenario where a separate router would provide any concrete value to the user. Given how the gRPC-server routes work with a constant path that cannot be changed and providing multiple actual routes with one entry I don't think the familiarity card is good enough motivation for re-introducing the boilerplate. |
I think the changes in #378 open an interesting discussion specially to avoid userland code to extand both At same time, the change suggested in #378 requires more work from the user in Play. I'd rather not merge #378 yet and move forward with the API as is (user code extends an abstract |
See #378 (comment). |
Current code generation creates an abstract class that is both a Play router and a service class. This makes it easier to wire together the application (no need to configure a binding for the service implementation) but it's not the usual way that Play apps are written. Usually the router is one class and the controller (with action logic) is another. I think it would make sense if we followed this pattern for gRPC code generation too - have the router as one class and the service implementation as another.
Example code snippets taken from codegen as at 21 August 2018:
The text was updated successfully, but these errors were encountered: