pbandk
pbandk copied to clipboard
generate classes with non-null Message types with custom options / extensions
Refers to
- #242
Overview
Allow not nullable Message types to be generated by using custom protobuf options or extensions.
- Added tests to verify stuff are working fine.
How
- Add a new option called
required_field_extension_number. - Update
CodeGeneratorto allow nullableMESSAGEtype and set the default value to be the constructor invocation (default instance)
Risks
- Extension number clashing, I find it unlikely but could be nice to double-check.
- Circular dependency, I left this one to the user. Circular paths with not nullable messages lead to infinite recursion.