ktr0731 / evans

Evans: more expressive universal gRPC client
MIT License
4.23k stars 187 forks source link

Small fixes. #684

Open AYehia0 opened 10 months ago

AYehia0 commented 10 months ago

There are some issues with simple fixes:-

Imagine this scenario:

- pb/
- proto/
    - user.proto
    - main_service.proto

user.proto

syntax = "proto3"; // use the latest syntax

package pb; // just to group things

import "google/protobuf/timestamp.proto";

option go_package = "github.com/AYehia0/go-bk-mst/pb";

// the main user
message User {
    // <data_type> <name> = <id>
    string username = 1;
    string email = 2;
    string full_name = 3;
    google.protobuf.Timestamp password_changed_at = 4;
    google.protobuf.Timestamp created_at = 5;
}

// create user
message CreateUserResponse {
    User user = 1;
}
message CreateUserRequest {
    string username = 1;
    string email = 2;
    string full_name = 3;
    string password = 4;
}

// login user
message LoginUserResponse {
    User user = 1;
    string access_token = 2;
    string refresh_token = 3;
    string session_id = 4;
    google.protobuf.Timestamp access_token_expires_at = 5;
    google.protobuf.Timestamp refresh_token_expires_at = 6;
}
message LoginUserRequest {
    string username = 1;
    string password = 2;
}

the main service

syntax = "proto3";

import "user.proto";

package pb;

option go_package = "github.com/AYehia0/go-bk-mst/pb";

service SimpleBank {
    rpc CreateUser (CreateUserRequest) returns (CreateUserResponse) {}
    rpc LoginUser (LoginUserRequest) returns (LoginUserResponse) {}
}

It panics : ListRPCs must not return an error, but got 'failed to resolve service pb.SimpleBank: proto: could not resolve import "user.proto": not found'

Specs