Quick steps to generate a thrift interface for your language:
- Download and install the thrift code generator
- Navigate to the directory containing your .thrift files.
- Run thrift with the options for your language of choice. e.g.
thrift -php myproject.thrift
- Your files will be generated in a sub directory called e.g.
Caveat: Service Method Parameter Naming
Make sure you don't name variables the same as their datatype - you WILL run in to trouble.
Consider this example BAD CODE:
Though the Thrift compiler compiles this example successfully the generated code will NOT compile.
Also note that using terms like "new" as a function name will cause errors in the generated code.
Caveat: Service Method Name Overloading
Make sure you don't overload service methods.
Thrift will compile this, however the generated code will NOT compile.