-
Notifications
You must be signed in to change notification settings - Fork 55
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
Typing of response of service resource #278
Comments
With our current approach we don't also have a way to record say media type + content schema of responses. That's what Swagger calls "produces": https://swagger.io/docs/specification/2-0/basic-structure/. |
I haven’t thought this through, but the Swagger “produces” concept triggered the following idea:
|
Yes I was thinking along the lines of your point 1 too. Ref the action, there are protocol specific actions currently to actually send the response and given the different kinds of replies based on protocol and the terminology used: http - respond, grpc - send but maybe that's fixable. The signatures would not match of course. Ref point 3, if the action returns an error then the resource function returns an error. In that case the protocol driver (which is the one that invokes the resource function in the first place) is responsible for responding / negotiating the protocol properly. For HTTP that might be simply to return 500 server error. For a lower level protocol it may be just to close the socket. |
If you are writing a client and service in Ballerina, it would be nice if the service declaration could be used as a client declaration. |
This is handled by #612. We drop the requirement that resource methods (which become service remote methods) return a subtype of |
The type of a service resource method does not make explicit the type of the response that the resource method will send to a client when it is invoked.
This is not a good fit for gRPC and will likely cause problems for session typing across Ballerina programs.
@sanjiva points out that “using return has the problem that the code doesn't know whether return succeeded - that's why it was done that way from the start”
The text was updated successfully, but these errors were encountered: