-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Result of gateway's Stream response is wrapped with "result" #579
Comments
Same question. Is there any way remove this wrapper? |
Can you provide some sample inputs and outputs (both expected and what you did receive) as well as the proto you used to define? |
Well, It's simple. The actual return value of server side stream is like: |
Are you waiting for a response?
At that time,
However, the response between the server and the client using the generated gateway is as follows.
This "result" is attached only to grpc-gateway, it is unnecessary. |
Yeah i'm confused, what's the reason for this? @johanbrandhorst any guidance how to tackle this? so what could we do? i see, without thinking over it too long, these possibilities:
I guess 1) would be best, as the "results" field just looks awkward and should not be there. But realistically, i guess we won't introduce such a breaking change. thoughts? edit: also: any plans for a targeted v2 release, where such things could be implemented/fixed? maybe a v2 / "next" branch where early adopters could get these changes asap? |
This puzzled me a lot as well initially, but I think now that the wrapper is so that we can provide "result" with successful calls and "error" when a call fails and we return a marshalled error. Because we can't use trailers with success or failure codes like gRPC does, we have to have some way to differentiate between success and failure, hence the wrapper. With that in mind, option 2 is the preferred solution here. In addition, I'm not sure swagger really supports streaming responses anyway? Yes, we do plan on releasing a v2 at some point, though all the current maintainers are busy so the project is really in maintenance mode. There's a v2 PR open and an issue label you can take a look at if you are interested in picking that up. As to option 3, you'll be pleased to know that such a solution kind of exists in https://github.com/tmc/grpc-websocket-proxy. |
Reopening since @birdayz might still want to submit a fix for this. |
…#850) * #579 fixing protoc-gen-swagger to wrap server stream messages with "result" object to match gateway behavior * #579 fixing test example swagger json * change streamdefinitions to x-stream-definitions and add test * move runtime internal to root of repo for use in protoc-gen-swagger, adding error to stream wrapper * adding comment explaining AddStreamError * fix bazel
…grpc-ecosystem#850) * grpc-ecosystem#579 fixing protoc-gen-swagger to wrap server stream messages with "result" object to match gateway behavior * grpc-ecosystem#579 fixing test example swagger json * change streamdefinitions to x-stream-definitions and add test * move runtime internal to root of repo for use in protoc-gen-swagger, adding error to stream wrapper * adding comment explaining AddStreamError * fix bazel
The output result of swagger is not wrapped with
result
even if it is stream.However, because the
gateway
's response definition is wrapped in result, it can not be automatically corresponded.Is there a way to associate these with each other?
The text was updated successfully, but these errors were encountered: