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

Do grpc-server nodes support import in proto files? #19

Open
jeff-bonevich opened this issue Apr 22, 2021 · 3 comments
Open

Do grpc-server nodes support import in proto files? #19

jeff-bonevich opened this issue Apr 22, 2021 · 3 comments

Comments

@jeff-bonevich
Copy link

I do not see support for imports of external proto files into the definition supplied to a grpc-server? Is this a feature on the roadmap? or am I (as usual) just missing how to do this? Thanks!

@namgk
Copy link
Collaborator

namgk commented Apr 22, 2021

Is there a problem with copy/pasting the content? Sorry I was a bit busy, will working on the PR as soon as I can.

@jeff-bonevich
Copy link
Author

Well, it might honestly be my inexperience with gRPC. I need to import a separate proto file that has a different package namespace for messages. So if I have the following:

syntax = "proto3";
import "SiLAFramework.proto";

package bonez.dht11;

// Feature: DHT11 SiLA2 Provider
//   SiLA2 drivers for the DHT11 Humiture Sensor
service DHT11Provider {
    rpc GetTemperature(bonez.dht11.GetTemperature_Parameters) returns (bonez.dht11.GetTemperature_Responses) {}
    rpc GetHumidity(bonez.dht11.GetHumidity_Parameters) returns (bonez.dht11.GetHumidity_Responses) {}
}

// ------ Command Parameter and Response definitions -------
message GetTemperature_Parameters {
}

message GetTemperature_Responses {
    sila2.org.silastandard.Real Temperature = 1;
}

message GetHumidity_Parameters {
}

message GetHumidity_Responses {
    sila2.org.silastandard.Real Humidity = 1;
}

and the references to sila2.org.silastandard.Real come from the import:

syntax = "proto3";

package sila2.org.silastandard;

option java_outer_classname = "SiLAFramework";

// -------- SiLA Basic Types --------
[snipped]

message Real {
    double value = 1;
}

and I am unsure then how I can just paste in the 'Real' message definition as 'message sila2.org.silastandard.Real..' gives me errors:

"createGRPCServer - Error: illegal type name 'sila2.org.silastandard.Real' (/var/folders/vr/9bgzlkzs4z7_zxmv64n70d5xg15dzy/T/foobar-jcNOFO/proto.txt, line 29)"

@namgk
Copy link
Collaborator

namgk commented Apr 22, 2021 via email

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

2 participants