go-kratos / kratos

Your ultimate Go microservices framework for the cloud-native era.
https://go-kratos.dev
MIT License
23.18k stars 4k forks source link

`stream` response in proto failed to generate http client #3324

Closed akoserwal closed 1 week ago

akoserwal commented 4 months ago

What happened:

rpc Subject(TestRequest) returns (stream TestResponse) {
        option (google.api.http) = {
            get: "/v1/subjects"
        };
    };

Running kratos proto client api/helloworld/demo.proto

doesn't generate only _grpc.pb.go

_http.pb.go

What you expected to happen:

generate HTTP and grpc client

How to reproduce it (as minimally and precisely as possible):

Add stream response

Anything else we need to know?:

Environment:

lonetrail commented 4 months ago

http client is not supported yet. #1958 #2896

shenqidebaozi commented 4 months ago

HTTP has not yet thought of a good abstraction to implement one-way and two-way stream

akoserwal commented 4 months ago

That's true. Is it possible to handle the stream case like: grpc-gatewat https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/httpbody_messages/ ?

shenqidebaozi commented 4 months ago

That's true. Is it possible to handle the stream case like: grpc-gatewat https://grpc-ecosystem.github.io/grpc-gateway/docs/mapping/httpbody_messages/ ?

I need some time to study it

akoserwal commented 3 months ago

Example project to showcase adding an HTTP handler for the gRPC stream endpoint: https://github.com/akoserwal/stream-ex-kratos/blob/main/internal/server/http.go#L40 @shenqidebaozi

shenqidebaozi commented 3 months ago

@akoserwal Let me take a look