twitter/scrooge — pull request #41 by erikvanoosten (2013-01-17 15:47:18+00:00)
Title: Compatibility with Thrift compiler

Background: we are heavy users of the regular thrift compiler. Our thrift files are shared across many services.

Currently we do not specify requiredness anywhere. For structs this results in classes with constructors that contain all fields of the struct. As soon as we specify a field as optional, the field disappears from the constructor. Basically, this means we have to rewrite our entire code base.

Not specifying the requiredness in the thrift file is not working when using Scrooge. We frequently put null in fields to specify they are not present. Scrooge does not allow this while writing fields of unspecified requiredness.

Although we like the strictness of Scrooge, we can not use it.

This pull request adds the option --allowNull which will simply skip writing fields that are null, regardsless of their requiredness.

I could not figure out how to write tests. Any advice to add these is appreciated.