Proto. My import proto file doesn`t work. Why I get error "Type" is not a type."?

777 Views Asked by At

Main file:


    syntax = "proto3";
    
    option csharp_namespace = "Service.Protos";
    
    package provider;
    
    import "type.proto";
    
    service provider {
      rpc Test (TestRequest) returns (TestResponse);
    }
    
    message TestRequest {
      Type Type = 1;
    }
    message TestResponse { }

Import file:

syntax = "proto3";

option csharp_namespace = "Service.Protos";

package Type;

enum Type {
  None = 0;
  ...
}

I get error: "Type" is not a type." Help me please. Why it doesn`t work? Both files are side by side

1

There are 1 best solutions below

0
On

I think it should be Type.Type, because of the package name. Like this:

  message TestRequest {
      Type.Type Type = 1;
  }

I have tried it with Go and it works for me.