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

Returning Services within a Service Definition File #1776

Closed
ebitogu opened this issue May 4, 2021 · 1 comment
Closed

Returning Services within a Service Definition File #1776

ebitogu opened this issue May 4, 2021 · 1 comment

Comments

@ebitogu
Copy link

ebitogu commented May 4, 2021

I have a bunch of proto files with each meant for a specific task as below:

The first one is called location.proto

syntax = "proto3";

package location;

import "protos/auth.proto";

service LocationManager{
    rpc updateLocation(LocationUpdateRequest) returns (LocationUpdateResponse);
}

enum LocationUpdateTarget{
    CUSTOMER = 0;
    RIDER = 1;
}

message Location{
     double longitude = 3;
     double latitude = 4;
}

message LocationUpdateRequest{
    auth.AuthParams authParams = 1;
    LocationUpdateTarget locationUpdateTarget = 2;
    Location location = 3;
}

message LocationUpdateResponse{
    int32 statusCode = 1;
}

And then I have the index.proto file that is referencing the above location.proto file as below:

syntax = "proto3";

package service_locator;

import "protos/location.proto";
import "protos/order.proto";

service ServiceLocator{
    rpc getLocationService (noparams) returns (location.LocationManager());
    // rpc getOrderService (noparams) returns (order.OrderManager());
}

message noparams{}

Whenever I pass the index.proto file to the grpc-protoloader I am getting the following error

Error: illegal token '(', ')' expected (line 12)

I have no idea where the error is coming from and no idea what it means.

What could I be doing wrong with my index.proto file?

Thanks in anticipation for your help.

@murgatroid99
Copy link
Member

Your ServiceLocator definition does not look valid. An RPC can't return a service or method, it can only return a message. And this syntax location.LocationManager() with the parentheses doesn't look like any protobuf syntax I'm familiar with.

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