The previous change to cache object definitions started returning the
bare TObj from build_type for object schemas, discarding the nullable
flag. This caused nullable root objects to be emitted as plain structs
instead of std::optional<RootInner>, breaking the nullable root tests.
Return the (TObj, nullable) tuple so callers (including the root
emitter) see the correct nullability again.
Extend the existing per-definition cache (`self._building`) to enum,
array, and scalar $defs, not just object definitions. This ensures
that multiple $refs to the same non-object definition reuse the same
C++ type instead of generating Role, Role2, Role3, etc.
- Cache the built (type, nullable) tuple under defname for enum,
scalar, and array definitions.
- Pre-register array definitions before recursing into items so $ref
cycles resolve to the same TArr instance.
- Store object definitions as (TObj, nullable) tuples so nullable object
$defs also preserve their nullability when referenced.
Add a regression test for issue #17 covering reused enum and array-of-enum
$defs.