Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thrift include: Type has not been defined

Tags:

thrift

I have a two thrift files: common.thrift, proto.thrift

content:

common.thrift

namespace java ru.domain.myserv.common

struct MyStruct {
    1: i32 val
}

service MyServ {
    1: MyStruct myStruct,
    2: i32 val
}

proto.thrift

include "common.thrift"

namespace java ru.domain.myserv.proto

typedef ru.domain.myserv.common.MyServ MyServ

struct ProtoServ {
    1: MyServ myServ
}

Next, I run the thrift generator:

thrift -r -out ../java --gen java proto.thrift

And I see an errors in console:

[ERROR:/path/proto.thrift:8] (last token was 'ru.domain.myserv.common.MyServ') Type "ru.domain.myserv.common.MyServ" has not been defined.

What I'm doing wrong?

like image 811
jonua Avatar asked Apr 24 '26 02:04

jonua


1 Answers

Oh my God.

I had to specify

typedef common.MyServ MyServ

instead of

typedef ru.domain.myserv.common.MyServ MyServ

But for what then namesapace is necessary?

like image 122
jonua Avatar answered May 01 '26 08:05

jonua



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!