Skip to content
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

Enhancement - protoc - service definitions - generate gRPC service definitions #118

Closed
johndpope opened this issue Oct 23, 2016 · 6 comments

Comments

@johndpope
Copy link

johndpope commented Oct 23, 2016

I need some clarification on how to proceed with a hello world protobuffer example
There is such a library here
https://github.com/hosopy/grpc-mobile-demo-ios/blob/master/GrpcMobileDemo/HelloWorldViewController.swift

but it's not using the swift-protobuf code base.

I am using this code base - but running into some troubles.
https://github.com/johndpope/swift3-grpc-example

Namely - it appears that the service part of proto file is not generated

https://developers.google.com/protocol-buffers/docs/proto3

syntax = "proto3";

package cali.nlp;

import "syntaxnet/sentence.proto";

message ParseyRequest {
  repeated string text = 1;
};

message ParseyResponse {
  repeated syntaxnet.Sentence result = 1;
};

**service ParseyService** {
  rpc Parse(ParseyRequest) returns (ParseyResponse);
}

According to google's webpages for third party plugins
https://github.com/google/protobuf/blob/master/docs/third_party.md

screen shot 2016-10-22 at 20 11 41

Are there any plans to support this?

@johndpope johndpope changed the title protoc - service definitions - help generate file enhancement - protoc - service definitions - generate service definitions Oct 23, 2016
@johndpope johndpope changed the title enhancement - protoc - service definitions - generate service definitions Enhancement - protoc - service definitions - generate service definitions Oct 23, 2016
@johndpope
Copy link
Author

after some digging found this -

https://github.com/grpc/grpc/tree/master/src/objective-c

The --objcgrpc_out plugin generates a pair of .pbrpc.h/.pbrpc.m files for each .proto file with

a service defined.

s.subspec 'Services' do |ss|
ss.source_files = "#{dir}/*.pbrpc.{h,m}"
ss.header_mappings_dir = dir
ss.requires_arc = true
# The generated files depend on the gRPC runtime, and on the files generated by --objc_out.
ss.dependency 'gRPC-ProtoRPC'
ss.dependency "#{s.name}/Messages"
end

we need a --swiftgrpc_out

@thomasvl
Copy link
Collaborator

grpc is a different project that layers on top of protocol buffers. So similar to https://github.com/google/protobuf/ not directly things with services, something else is free to layer that on top of this project. Odds are https://github.com/grpc/grpc will provide one once this project is more complete.

@jcanizales
Copy link

Hey John, until we have a native gRPC Swift library, you might want to use ObjC gRPC from Swift. The automatic syntax translation makes it look pretty decent (I personally prefer to use it from Swift rather than directly in ObjC). Here's an example (to try it you just need to run pod install in its directory and that'll generate the protos and configure the dependencies).

@johndpope
Copy link
Author

Thanks Jorge,

Looking forward to the day gRPC supports swift3 server side
grpc/grpc#8470

@thomasvl
Copy link
Collaborator

Realized I forgot to add one other thing the other day. grpc spells out one means to send the protos back and forth. But I've seen other methods used for other projects. So by keeping it out of the core protobuf project, we provide a common protobuf that can be used with all those different transport specs.

@johndpope johndpope changed the title Enhancement - protoc - service definitions - generate service definitions Enhancement - protoc - service definitions - generate gRPC service definitions Oct 24, 2016
@johndpope
Copy link
Author

breaking news - grpc/grpc-swift#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants