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

Generates duplicate entries - produces code that does not compile #11

Open
drasko opened this issue Oct 6, 2018 · 0 comments
Open

Generates duplicate entries - produces code that does not compile #11

drasko opened this issue Oct 6, 2018 · 0 comments

Comments

@drasko
Copy link

drasko commented Oct 6, 2018

This proto:


syntax = "proto3";

package mainflux;

service ThingsService {
    rpc CanAccess(AccessReq) returns (ThingID) {}
    rpc Identify(Token) returns (ThingID) {}
}

service UsersService {
    rpc Identify(Token) returns (UserID) {}
}

message AccessReq {
    string token = 1;
    uint64 chanID = 2;
}

message ThingID {
    uint64 value = 1;
}

message Token {
    string value = 1;
}

message UserID {
    string value = 1;
}

Results in the following code:

-module(internal_client).

%% this file was generated by grpc

-export(['CanAccess'/3,
         'Identify'/3,
         'Identify'/3]).

-type 'AccessReq'() ::
    #{token => string(),
      chanID => integer()}.

-type 'ThingID'() ::
    #{value => integer()}.

-type 'Token'() ::
    #{value => string()}.

-type 'UserID'() ::
    #{value => string()}.

-export_type(['AccessReq'/0,
              'ThingID'/0,
              'Token'/0,
              'UserID'/0]).

-spec decoder() -> module().
%% The module (generated by gpb) used to encode and decode protobuf
%% messages.
decoder() -> internal.

%% RPCs for service 'ThingsService'

-spec 'CanAccess'(
        Connection::grpc_client:connection(),
        Message::'AccessReq'(),
        Options::[grpc_client:stream_option() |
                  {timeout, timeout()}]) ->
        grpc_client:unary_response('ThingID'()).
%% This is a unary RPC
'CanAccess'(Connection, Message, Options) ->
    grpc_client:unary(Connection, Message,
                      'ThingsService', 'CanAccess',
                       decoder(), Options).

-spec 'Identify'(
        Connection::grpc_client:connection(),
        Message::'Token'(),
        Options::[grpc_client:stream_option() |
                  {timeout, timeout()}]) ->
        grpc_client:unary_response('ThingID'()).
%% This is a unary RPC
'Identify'(Connection, Message, Options) ->
    grpc_client:unary(Connection, Message,
                      'ThingsService', 'Identify',
                       decoder(), Options).

%% RPCs for service 'UsersService'

-spec 'Identify'(
        Connection::grpc_client:connection(),
        Message::'Token'(),
        Options::[grpc_client:stream_option() |
                  {timeout, timeout()}]) ->
        grpc_client:unary_response('UserID'()).
%% This is a unary RPC
'Identify'(Connection, Message, Options) ->
    grpc_client:unary(Connection, Message,
                      'UsersService', 'Identify',
                       decoder(), Options).

This Erlang code does not compile because of duplicated Identify() function definition.

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

1 participant