Though thrift supports defining recursive structs, it appears that the Ruby codegen does not generate valid Ruby for for recursive structs.
e.g. Here's an example of what I'm seeing and how to recreate it using Recursive.thrift in the Thrift test suite.
- add $(THRIFT) --gen rb ../Recursive.thrift to test/rb/Makefile.am
- and add require "recursive_types" to test/rb/generation/test_struct.rb
- run make -k check from test/rb
- this ends up raising the following exception:
I've copied the generated code below. But essentially the issue appears to be that recursive structs are referencing constants or classes that have not yet been declared. I have some ideas on how to address this and can post a proposed solution.