Yes, and it is as @Vj- correctly pointed out:
include "path/to/file.thrift"
By the way, it is possible to generate code for all thrift IDL including the included files by using the -r
(for recursive) when calling the compiler.
There are two important things to know:
(1) Definitions from the included file are referred in the including file using a prefix, which comes from the file name of the included IDL. The tutorial has a good example (note the shared
prefix):
include "shared.thrift"
service Calculator extends shared.SharedService {
// more code
}
(2) it is very recommended to declare different namespaces in every IDL file. Otherwise it could happen with some target languages (for example PHP), that the code generated from the outer IDL overwrites the code generated from the inner IDL because the same output folder is used.
For example:
namespace * tutorial
and
namespace * shared