fix(vertex): keep the basedpyright gate level for the anyOf enum arm

The anyOf arm read its branches through schema.get on the unannotated schema dict, so after merging main it added one reportUnknownMemberType, one reportUnknownArgumentType and two reportUnknownVariableType errors, and scripts/type_check_gate.py holds each rule at its merge-base count

Test the key and the list type the way the enum check above already does, and read the branches as list[object] with the cast-ok idiom used elsewhere in this file. No behaviour change, the four regression tests still pass
This commit is contained in:
Ambuj Upadhyay 2026-10-27 07:53:54 +05:30
parent 0bd46d8df3
commit b6a4384e7b

View file

@ -672,9 +672,8 @@ def _fix_enum_empty_strings(schema, depth=0):
# An Optional[Literal[...]] arrives here as an `anyOf` branch, because
# convert_anyof_null_to_nullable runs first. Without this arm the empty string
# survives on optional fields while the same enum is fixed on required ones.
anyof: Final = schema.get("anyOf", None)
if anyof is not None and isinstance(anyof, list):
for item in anyof:
if "anyOf" in schema and isinstance(schema["anyOf"], list):
for item in cast(list[object], schema["anyOf"]): # cast-ok: an untyped JSON list
_fix_enum_empty_strings(item, depth=depth + 1)