utrack / clay

Proto-first minimal server platform for gRPС+REST+Swagger APIs
MIT License
290 stars 37 forks source link

Define errors' model for Swagger docs #83

Open utrack opened 4 years ago

utrack commented 4 years ago

Since grpc-ecosystem/grpc-gateway#1127 it's possible to define an Error message via registering .grpc.gateway.runtime.Error and .grpc.gateway.runtime.StreamError.

Right now, these definitions are explicitly disabled in clay via SetDisableDefaultErrors(true), but it would be great to reenable them if the user somehow provides an Error when generating Go code.

zengzhengrong commented 4 years ago

I define server streaming , but i got the error

E0610 09:58:27.961171   32743 template.go:284] no message found: StreamError

if i define the http rule in yaml , like this

   - selector: user_center.ManageUserCenter.GetSimilarUsers
      get: '/v1/fnuos/userCenter/getSimilarUsers'

pb.goclay.go have a error,

unmFunc := unmarshaler_goclay_ManageUserCenter_GetSimilarUsers_0(r)
            rsp, err := _ManageUserCenter_GetSimilarUsers_Handler(d.svc, r.Context(), unmFunc, d.opts.UnaryInterceptor)

_ManageUserCenter_GetSimilarUsers_Handler is a serverstream ,but the parameter is unary implementation,so does http rule support streaming ?