schemagen: restore nullable tuple return for object schemas
CI / pre-commit (pull_request) Successful in 51s
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-arm64, ubuntu-latest-arm64, true) (pull_request) Successful in 1m1s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-arm64, ubuntu-latest-arm64, false) (pull_request) Successful in 1m0s
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-amd64, ubuntu-latest-amd64, true) (pull_request) Successful in 1m28s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-amd64, ubuntu-latest-amd64, false) (pull_request) Successful in 1m23s

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.
This commit is contained in:
2026-06-24 09:51:19 -04:00
parent 717f30099f
commit e155e0bbf4
+1 -1
View File
@@ -306,7 +306,7 @@ class Builder:
return result return result
if typ == "object" or (typ is None and "properties" in node): if typ == "object" or (typ is None and "properties" in node):
return self._build_object(node, hint, defname, nullable) return (self._build_object(node, hint, defname, nullable), nullable)
if typ == "array": if typ == "array":
if "items" not in node or not isinstance(node["items"], dict): if "items" not in node or not isinstance(node["items"], dict):