Skip to content

Commit

Permalink
Implement grpc-gateway Delimited interface
Browse files Browse the repository at this point in the history
Implement the Delimited interface for the gogo/protobuf JSONPb marshaller.

Fixes #20925
  • Loading branch information
johanbrandhorst committed Dec 22, 2017
1 parent 9bfe0af commit d1a8109
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ignored = [
name = "github.com/go-sql-driver/mysql"
branch = "master"

# https://github.com/grpc-ecosystem/grpc-gateway/commit/893772d
# https://github.com/grpc-ecosystem/grpc-gateway/commit/8db8c1a
[[constraint]]
name = "github.com/grpc-ecosystem/grpc-gateway"
branch = "master"
Expand Down
7 changes: 7 additions & 0 deletions pkg/util/protoutil/jsonpb_marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,10 @@ func (j *JSONPb) NewEncoder(w io.Writer) gwruntime.Encoder {
return errors.Errorf("unexpected type %T does not implement %s", v, typeProtoMessage)
})
}

var _ gwruntime.Delimited = (*JSONPb)(nil)

// Delimiter implements gwruntime.Delimited.
func (*JSONPb) Delimiter() []byte {
return []byte("\n")
}
7 changes: 7 additions & 0 deletions pkg/util/protoutil/marshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,10 @@ func (e *protoEncoder) Encode(v interface{}) error {
}
return errors.Errorf("unexpected type %T does not implement %s", v, typeProtoMessage)
}

var _ gwruntime.Delimited = (*ProtoPb)(nil)

// Delimiter implements gwruntime.Delimited.
func (*ProtoPb) Delimiter() []byte {
return nil
}
2 changes: 1 addition & 1 deletion vendor
Submodule vendor updated 42 files
+1 −0 github.com/grpc-ecosystem/grpc-gateway/.gitignore
+1 −1 github.com/grpc-ecosystem/grpc-gateway/.travis.yml
+9 −2 github.com/grpc-ecosystem/grpc-gateway/Makefile
+3 −3 github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/a_bit_of_everything_nested.go
+42 −28 github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/a_bit_of_everything_service_api.go
+3 −3 github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/api_client.go
+3 −3 github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/api_response.go
+3 −3 github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/configuration.go
+3 −3 github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/examplepb_a_bit_of_everything.go
+3 −3 github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/examplepb_numeric_enum.go
+3 −3 github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/nested_deep_enum.go
+3 −3 github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/protobuf_empty.go
+3 −3 github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/sub_string_message.go
+18 −18 github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo/echo_service_api.go
+116 −83 github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.pb.go
+11 −11 github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.pb.gw.go
+64 −0 github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.proto
+51 −12 github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.swagger.json
+3 −3 github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.pb.gw.go
+1 −1 github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.swagger.json
+26 −26 github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.pb.gw.go
+3 −3 github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.pb.gw.go
+13 −0 github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/registry.go
+6 −1 github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/services.go
+14 −0 github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/types.go
+3 −0 github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/generator.go
+72 −7 github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/generator_test.go
+3 −1 github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/main.go
+208 −20 github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/template.go
+15 −12 github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/types.go
+83 −0 github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options/annotations.pb.go
+37 −0 github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options/annotations.proto
+739 −0 github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options/openapiv2.pb.go
+223 −0 github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options/openapiv2.proto
+18 −0 github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go
+27 −7 github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go
+173 −36 github.com/grpc-ecosystem/grpc-gateway/runtime/handler_test.go
+5 −0 github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go
+5 −0 github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go
+62 −0 github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_proto.go
+91 −0 github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_proto_test.go
+6 −0 github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go

0 comments on commit d1a8109

Please sign in to comment.